
<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width">

	<title>File catalog\controller\mail\subscription.php | OpenCart API API</title>
	<link rel="stylesheet" href="http://localhost\opencart-master/docs/api/assets/main.css">
	<script src="http://localhost\opencart-master/docs/api/assets/main.js" defer></script>
</head>

<body class="layout">
	<div class="layout-aside">
	<div class="menu">
			<div class="menu-section">
				<h3>Namespaces</h3>
	<ul>
			<li class="menuGroup-item active">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.html">Opencart</a>
	<ul>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Admin.html">Admin</a>
			</li>
			<li class="menuGroup-item active">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.html">Catalog</a>
	<ul>
			<li class="menuGroup-item active">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.html">Controller</a>
	<ul>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Account.html">Account</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Api.html">Api</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Checkout.html">Checkout</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Cms.html">Cms</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Common.html">Common</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Cron.html">Cron</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Error.html">Error</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Event.html">Event</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Extension.html">Extension</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Information.html">Information</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Localisation.html">Localisation</a>
			</li>
			<li class="menuGroup-item active">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Mail.html">Mail</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Product.html">Product</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Startup.html">Startup</a>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Tool.html">Tool</a>
			</li>
	</ul>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Model.html">Model</a>
			</li>
	</ul>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.System.html">System</a>
			</li>
	</ul>
			</li>
			<li class="menuGroup-item">
				<a href="http://localhost\opencart-master/docs/api/namespace-none.html">none</a>
			</li>
	</ul>
			</div>

		<div class="menu-section">
			<h3>Classes</h3>
			<ul>
					<li>
						<a href="http://localhost\opencart-master/docs/api/Opencart.Catalog.Controller.Mail.Affiliate.html">
							Affiliate
						</a>
					</li>
					<li>
						<a href="http://localhost\opencart-master/docs/api/Opencart.Catalog.Controller.Mail.Forgotten.html">
							Forgotten
						</a>
					</li>
					<li>
						<a href="http://localhost\opencart-master/docs/api/Opencart.Catalog.Controller.Mail.Gdpr.html">
							Gdpr
						</a>
					</li>
					<li>
						<a href="http://localhost\opencart-master/docs/api/Opencart.Catalog.Controller.Mail.Order.html">
							Order
						</a>
					</li>
					<li>
						<a href="http://localhost\opencart-master/docs/api/Opencart.Catalog.Controller.Mail.Register.html">
							Register
						</a>
					</li>
					<li>
						<a href="http://localhost\opencart-master/docs/api/Opencart.Catalog.Controller.Mail.Review.html">
							Review
						</a>
					</li>
					<li class="active">
						<a href="http://localhost\opencart-master/docs/api/Opencart.Catalog.Controller.Mail.Subscription.html">
							Subscription
						</a>
					</li>
					<li>
						<a href="http://localhost\opencart-master/docs/api/Opencart.Catalog.Controller.Mail.Transaction.html">
							Transaction
						</a>
					</li>
					<li>
						<a href="http://localhost\opencart-master/docs/api/Opencart.Catalog.Controller.Mail.Voucher.html">
							Voucher
						</a>
					</li>
			</ul>
		</div>
	</div>
	</div>

	<div class="layout-main">
		<div class="layout-navbar">
	<nav class="navbar">
		<div class="navbar-left">
			<ul class="navbar-links">
				<li>
					<a href="http://localhost\opencart-master/docs/api/index.html">Overview</a>
				</li>
				<li>
					
						<a href="http://localhost\opencart-master/docs/api/namespace-Opencart.Catalog.Controller.Mail.html">Namespace</a>
					
				</li>
<li class="active"><a href="http://localhost\opencart-master/docs/api/Opencart.Catalog.Controller.Mail.Subscription.html">Class</a></li>				<li>
					<a href="http://localhost\opencart-master/docs/api/tree.html">Tree</a>
				</li>
			</ul>
		</div>
		<div class="navbar-right">
	<div class="search" data-elements="http://localhost\opencart-master/docs/api/assets/elements.js">
		<input class="search-input" placeholder="Search class, function or namespace" autofocus>
		<ul class="search-results"></ul>
	</div>
		</div>
	</nav>
		</div>

		<div class="layout-content">
	<table class="source"><tr id="1" class="source-line"><td><a class="source-lineNum" href="#1">  1: </a></td><td><span class="php-tag">&lt;?php</span></td></tr><tr id="2" class="source-line"><td><a class="source-lineNum" href="#2">  2: </a></td><td><span class="php-tag"></span><span class="php-kw">namespace</span> Opencart\Catalog\Controller\Mail;</td></tr><tr id="3" class="source-line"><td><a class="source-lineNum" href="#3">  3: </a></td><td><span class="php-comment">/**</span></td></tr><tr id="4" class="source-line"><td><a class="source-lineNum" href="#4">  4: </a></td><td><span class="php-comment"> * Class Subscription</span></td></tr><tr id="5" class="source-line"><td><a class="source-lineNum" href="#5">  5: </a></td><td><span class="php-comment"> *</span></td></tr><tr id="6" class="source-line"><td><a class="source-lineNum" href="#6">  6: </a></td><td><span class="php-comment"> * @package Opencart\Catalog\Controller\Mail</span></td></tr><tr id="7" class="source-line"><td><a class="source-lineNum" href="#7">  7: </a></td><td><span class="php-comment"> */</span></td></tr><tr id="8" class="source-line"><td><a class="source-lineNum" href="#8">  8: </a></td><td><span class="php-kw">class</span> Subscription <span class="php-kw">extends</span> \Opencart\System\Engine\Controller {</td></tr><tr id="9" class="source-line"><td><a class="source-lineNum" href="#9">  9: </a></td><td>	<span class="php-comment">/**</span></td></tr><tr id="10" class="source-line"><td><a class="source-lineNum" href="#10"> 10: </a></td><td><span class="php-comment">	 * @param string            $route</span></td></tr><tr id="11" class="source-line"><td><a class="source-lineNum" href="#11"> 11: </a></td><td><span class="php-comment">	 * @param array&lt;int, mixed&gt; $args</span></td></tr><tr id="12" class="source-line"><td><a class="source-lineNum" href="#12"> 12: </a></td><td><span class="php-comment">	 * @param array&lt;mixed&gt;      $output</span></td></tr><tr id="13" class="source-line"><td><a class="source-lineNum" href="#13"> 13: </a></td><td><span class="php-comment">	 *</span></td></tr><tr id="14" class="source-line"><td><a class="source-lineNum" href="#14"> 14: </a></td><td><span class="php-comment">	 *  addHistory</span></td></tr><tr id="15" class="source-line"><td><a class="source-lineNum" href="#15"> 15: </a></td><td><span class="php-comment">	 *</span></td></tr><tr id="16" class="source-line"><td><a class="source-lineNum" href="#16"> 16: </a></td><td><span class="php-comment">	 * @return void</span></td></tr><tr id="17" class="source-line"><td><a class="source-lineNum" href="#17"> 17: </a></td><td><span class="php-comment">	 */</span></td></tr><tr id="18" class="source-line"><td><a class="source-lineNum" href="#18"> 18: </a></td><td>	<span class="php-kw">public</span> <span class="php-kw">function</span> index(string &amp;<span class="php-var">$route</span>, <span class="php-kw">array</span> &amp;<span class="php-var">$args</span>, &amp;<span class="php-var">$output</span>): void {</td></tr><tr id="19" class="source-line"><td><a class="source-lineNum" href="#19"> 19: </a></td><td>		<span class="php-kw">if</span> (<span class="php-kw">isset</span>(<span class="php-var">$args</span>[<span class="php-num">0</span>])) {</td></tr><tr id="20" class="source-line"><td><a class="source-lineNum" href="#20"> 20: </a></td><td>			<span class="php-var">$subscription_id</span> = <span class="php-var">$args</span>[<span class="php-num">0</span>];</td></tr><tr id="21" class="source-line"><td><a class="source-lineNum" href="#21"> 21: </a></td><td>		} <span class="php-kw">else</span> {</td></tr><tr id="22" class="source-line"><td><a class="source-lineNum" href="#22"> 22: </a></td><td>			<span class="php-var">$subscription_id</span> = <span class="php-num">0</span>;</td></tr><tr id="23" class="source-line"><td><a class="source-lineNum" href="#23"> 23: </a></td><td>		}</td></tr><tr id="24" class="source-line"><td><a class="source-lineNum" href="#24"> 24: </a></td><td></td></tr><tr id="25" class="source-line"><td><a class="source-lineNum" href="#25"> 25: </a></td><td>		<span class="php-kw">if</span> (<span class="php-kw">isset</span>(<span class="php-var">$args</span>[<span class="php-num">1</span>][<span class="php-str">&#039;subscription&#039;</span>])) {</td></tr><tr id="26" class="source-line"><td><a class="source-lineNum" href="#26"> 26: </a></td><td>			<span class="php-var">$subscription</span> = <span class="php-var">$args</span>[<span class="php-num">1</span>][<span class="php-str">&#039;subscription&#039;</span>];</td></tr><tr id="27" class="source-line"><td><a class="source-lineNum" href="#27"> 27: </a></td><td>		} <span class="php-kw">else</span> {</td></tr><tr id="28" class="source-line"><td><a class="source-lineNum" href="#28"> 28: </a></td><td>			<span class="php-var">$subscription</span> = [];</td></tr><tr id="29" class="source-line"><td><a class="source-lineNum" href="#29"> 29: </a></td><td>		}</td></tr><tr id="30" class="source-line"><td><a class="source-lineNum" href="#30"> 30: </a></td><td></td></tr><tr id="31" class="source-line"><td><a class="source-lineNum" href="#31"> 31: </a></td><td>		<span class="php-kw">if</span> (<span class="php-kw">isset</span>(<span class="php-var">$args</span>[<span class="php-num">2</span>])) {</td></tr><tr id="32" class="source-line"><td><a class="source-lineNum" href="#32"> 32: </a></td><td>			<span class="php-var">$comment</span> = <span class="php-var">$args</span>[<span class="php-num">2</span>];</td></tr><tr id="33" class="source-line"><td><a class="source-lineNum" href="#33"> 33: </a></td><td>		} <span class="php-kw">else</span> {</td></tr><tr id="34" class="source-line"><td><a class="source-lineNum" href="#34"> 34: </a></td><td>			<span class="php-var">$comment</span> = <span class="php-str">&#039;&#039;</span>;</td></tr><tr id="35" class="source-line"><td><a class="source-lineNum" href="#35"> 35: </a></td><td>		}</td></tr><tr id="36" class="source-line"><td><a class="source-lineNum" href="#36"> 36: </a></td><td></td></tr><tr id="37" class="source-line"><td><a class="source-lineNum" href="#37"> 37: </a></td><td>		<span class="php-kw">if</span> (<span class="php-kw">isset</span>(<span class="php-var">$args</span>[<span class="php-num">3</span>])) {</td></tr><tr id="38" class="source-line"><td><a class="source-lineNum" href="#38"> 38: </a></td><td>			<span class="php-var">$notify</span> = <span class="php-var">$args</span>[<span class="php-num">3</span>];</td></tr><tr id="39" class="source-line"><td><a class="source-lineNum" href="#39"> 39: </a></td><td>		} <span class="php-kw">else</span> {</td></tr><tr id="40" class="source-line"><td><a class="source-lineNum" href="#40"> 40: </a></td><td>			<span class="php-var">$notify</span> = <span class="php-str">&#039;&#039;</span>;</td></tr><tr id="41" class="source-line"><td><a class="source-lineNum" href="#41"> 41: </a></td><td>		}</td></tr><tr id="42" class="source-line"><td><a class="source-lineNum" href="#42"> 42: </a></td><td>		<span class="php-comment">/*</span></td></tr><tr id="43" class="source-line"><td><a class="source-lineNum" href="#43"> 43: </a></td><td><span class="php-comment">		$subscription[&#039;order_product_id&#039;]</span></td></tr><tr id="44" class="source-line"><td><a class="source-lineNum" href="#44"> 44: </a></td><td><span class="php-comment">		$subscription[&#039;customer_id&#039;]</span></td></tr><tr id="45" class="source-line"><td><a class="source-lineNum" href="#45"> 45: </a></td><td><span class="php-comment">		$subscription[&#039;order_id&#039;]</span></td></tr><tr id="46" class="source-line"><td><a class="source-lineNum" href="#46"> 46: </a></td><td><span class="php-comment">		$subscription[&#039;subscription_plan_id&#039;]</span></td></tr><tr id="47" class="source-line"><td><a class="source-lineNum" href="#47"> 47: </a></td><td><span class="php-comment">		$subscription[&#039;customer_payment_id&#039;],</span></td></tr><tr id="48" class="source-line"><td><a class="source-lineNum" href="#48"> 48: </a></td><td><span class="php-comment">		$subscription[&#039;name&#039;]</span></td></tr><tr id="49" class="source-line"><td><a class="source-lineNum" href="#49"> 49: </a></td><td><span class="php-comment">		$subscription[&#039;description&#039;]</span></td></tr><tr id="50" class="source-line"><td><a class="source-lineNum" href="#50"> 50: </a></td><td><span class="php-comment">		$subscription[&#039;trial_price&#039;]</span></td></tr><tr id="51" class="source-line"><td><a class="source-lineNum" href="#51"> 51: </a></td><td><span class="php-comment">		$subscription[&#039;trial_frequency&#039;]</span></td></tr><tr id="52" class="source-line"><td><a class="source-lineNum" href="#52"> 52: </a></td><td><span class="php-comment">		$subscription[&#039;trial_cycle&#039;]</span></td></tr><tr id="53" class="source-line"><td><a class="source-lineNum" href="#53"> 53: </a></td><td><span class="php-comment">		$subscription[&#039;trial_duration&#039;]</span></td></tr><tr id="54" class="source-line"><td><a class="source-lineNum" href="#54"> 54: </a></td><td><span class="php-comment">		$subscription[&#039;trial_remaining&#039;]</span></td></tr><tr id="55" class="source-line"><td><a class="source-lineNum" href="#55"> 55: </a></td><td><span class="php-comment">		$subscription[&#039;trial_status&#039;]</span></td></tr><tr id="56" class="source-line"><td><a class="source-lineNum" href="#56"> 56: </a></td><td><span class="php-comment">		$subscription[&#039;price&#039;]</span></td></tr><tr id="57" class="source-line"><td><a class="source-lineNum" href="#57"> 57: </a></td><td><span class="php-comment">		$subscription[&#039;frequency&#039;]</span></td></tr><tr id="58" class="source-line"><td><a class="source-lineNum" href="#58"> 58: </a></td><td><span class="php-comment">		$subscription[&#039;cycle&#039;]</span></td></tr><tr id="59" class="source-line"><td><a class="source-lineNum" href="#59"> 59: </a></td><td><span class="php-comment">		$subscription[&#039;duration&#039;]</span></td></tr><tr id="60" class="source-line"><td><a class="source-lineNum" href="#60"> 60: </a></td><td><span class="php-comment">		$subscription[&#039;remaining&#039;]</span></td></tr><tr id="61" class="source-line"><td><a class="source-lineNum" href="#61"> 61: </a></td><td><span class="php-comment">		$subscription[&#039;date_next&#039;]</span></td></tr><tr id="62" class="source-line"><td><a class="source-lineNum" href="#62"> 62: </a></td><td><span class="php-comment">		$subscription[&#039;status&#039;]</span></td></tr><tr id="63" class="source-line"><td><a class="source-lineNum" href="#63"> 63: </a></td><td><span class="php-comment"></span></td></tr><tr id="64" class="source-line"><td><a class="source-lineNum" href="#64"> 64: </a></td><td><span class="php-comment"></span></td></tr><tr id="65" class="source-line"><td><a class="source-lineNum" href="#65"> 65: </a></td><td><span class="php-comment">		if ($subscription[&#039;trial_duration&#039;] &amp;&amp; $subscription[&#039;trial_remaining&#039;]) {</span></td></tr><tr id="66" class="source-line"><td><a class="source-lineNum" href="#66"> 66: </a></td><td><span class="php-comment">			$date_next = date(&#039;Y-m-d&#039;, strtotime(&#039;+&#039; . $subscription[&#039;trial_cycle&#039;] . &#039; &#039; . $subscription[&#039;trial_frequency&#039;]));</span></td></tr><tr id="67" class="source-line"><td><a class="source-lineNum" href="#67"> 67: </a></td><td><span class="php-comment">		} elseif ($subscription[&#039;duration&#039;] &amp;&amp; $subscription[&#039;remaining&#039;]) {</span></td></tr><tr id="68" class="source-line"><td><a class="source-lineNum" href="#68"> 68: </a></td><td><span class="php-comment">			$date_next = date(&#039;Y-m-d&#039;, strtotime(&#039;+&#039; . $subscription[&#039;cycle&#039;] . &#039; &#039; . $subscription[&#039;frequency&#039;]));</span></td></tr><tr id="69" class="source-line"><td><a class="source-lineNum" href="#69"> 69: </a></td><td><span class="php-comment">		}</span></td></tr><tr id="70" class="source-line"><td><a class="source-lineNum" href="#70"> 70: </a></td><td><span class="php-comment"></span></td></tr><tr id="71" class="source-line"><td><a class="source-lineNum" href="#71"> 71: </a></td><td><span class="php-comment">		// Subscription</span></td></tr><tr id="72" class="source-line"><td><a class="source-lineNum" href="#72"> 72: </a></td><td><span class="php-comment">		$this-&gt;load-&gt;model(&#039;account/subscription&#039;);</span></td></tr><tr id="73" class="source-line"><td><a class="source-lineNum" href="#73"> 73: </a></td><td><span class="php-comment"></span></td></tr><tr id="74" class="source-line"><td><a class="source-lineNum" href="#74"> 74: </a></td><td><span class="php-comment">		$filter_data = [</span></td></tr><tr id="75" class="source-line"><td><a class="source-lineNum" href="#75"> 75: </a></td><td><span class="php-comment">			&#039;filter_subscription_id&#039; =&gt; $subscription_id,</span></td></tr><tr id="76" class="source-line"><td><a class="source-lineNum" href="#76"> 76: </a></td><td><span class="php-comment">			&#039;filter_date_next&#039; =&gt; $date_next,</span></td></tr><tr id="77" class="source-line"><td><a class="source-lineNum" href="#77"> 77: </a></td><td><span class="php-comment">			&#039;filter_subscription_status_id&#039; =&gt; $this-&gt;config-&gt;get(&#039;config_subscription_active_status_id&#039;),</span></td></tr><tr id="78" class="source-line"><td><a class="source-lineNum" href="#78"> 78: </a></td><td><span class="php-comment">			&#039;start&#039; =&gt; 0,</span></td></tr><tr id="79" class="source-line"><td><a class="source-lineNum" href="#79"> 79: </a></td><td><span class="php-comment">			&#039;limit&#039; =&gt; 1</span></td></tr><tr id="80" class="source-line"><td><a class="source-lineNum" href="#80"> 80: </a></td><td><span class="php-comment">		];</span></td></tr><tr id="81" class="source-line"><td><a class="source-lineNum" href="#81"> 81: </a></td><td><span class="php-comment"></span></td></tr><tr id="82" class="source-line"><td><a class="source-lineNum" href="#82"> 82: </a></td><td><span class="php-comment">		$subscriptions = $this-&gt;model_account_subscription-&gt;getSubscriptions($filter_data);</span></td></tr><tr id="83" class="source-line"><td><a class="source-lineNum" href="#83"> 83: </a></td><td><span class="php-comment"></span></td></tr><tr id="84" class="source-line"><td><a class="source-lineNum" href="#84"> 84: </a></td><td><span class="php-comment">		if ($subscriptions) {</span></td></tr><tr id="85" class="source-line"><td><a class="source-lineNum" href="#85"> 85: </a></td><td><span class="php-comment">			$this-&gt;load-&gt;language(&#039;mail/subscription&#039;);</span></td></tr><tr id="86" class="source-line"><td><a class="source-lineNum" href="#86"> 86: </a></td><td><span class="php-comment"></span></td></tr><tr id="87" class="source-line"><td><a class="source-lineNum" href="#87"> 87: </a></td><td><span class="php-comment">			foreach ($subscriptions as $value) {</span></td></tr><tr id="88" class="source-line"><td><a class="source-lineNum" href="#88"> 88: </a></td><td><span class="php-comment">				// Only match the latest order ID of the same customer ID</span></td></tr><tr id="89" class="source-line"><td><a class="source-lineNum" href="#89"> 89: </a></td><td><span class="php-comment">				// since new subscriptions cannot be re-added with the same</span></td></tr><tr id="90" class="source-line"><td><a class="source-lineNum" href="#90"> 90: </a></td><td><span class="php-comment">				// order ID; only as a new order ID added by an extension</span></td></tr><tr id="91" class="source-line"><td><a class="source-lineNum" href="#91"> 91: </a></td><td><span class="php-comment">				if ($value[&#039;customer_id&#039;] == $subscription[&#039;customer_id&#039;] &amp;&amp; $value[&#039;order_id&#039;] == $subscription[&#039;order_id&#039;]) {</span></td></tr><tr id="92" class="source-line"><td><a class="source-lineNum" href="#92"> 92: </a></td><td><span class="php-comment">					// Payment Methods</span></td></tr><tr id="93" class="source-line"><td><a class="source-lineNum" href="#93"> 93: </a></td><td><span class="php-comment">					$this-&gt;load-&gt;model(&#039;sale/subscription&#039;);</span></td></tr><tr id="94" class="source-line"><td><a class="source-lineNum" href="#94"> 94: </a></td><td><span class="php-comment"></span></td></tr><tr id="95" class="source-line"><td><a class="source-lineNum" href="#95"> 95: </a></td><td><span class="php-comment">					$payment_method = $this-&gt;model_sale_subscription-&gt;getTotalSubscriptions([&#039;filter_customer_id&#039; =&gt; $value[&#039;customer_id&#039;]]);</span></td></tr><tr id="96" class="source-line"><td><a class="source-lineNum" href="#96"> 96: </a></td><td><span class="php-comment"></span></td></tr><tr id="97" class="source-line"><td><a class="source-lineNum" href="#97"> 97: </a></td><td><span class="php-comment">					if ($payment_method) {</span></td></tr><tr id="98" class="source-line"><td><a class="source-lineNum" href="#98"> 98: </a></td><td><span class="php-comment">						// Subscription</span></td></tr><tr id="99" class="source-line"><td><a class="source-lineNum" href="#99"> 99: </a></td><td><span class="php-comment">						$this-&gt;load-&gt;model(&#039;checkout/subscription&#039;);</span></td></tr><tr id="100" class="source-line"><td><a class="source-lineNum" href="#100">100: </a></td><td><span class="php-comment"></span></td></tr><tr id="101" class="source-line"><td><a class="source-lineNum" href="#101">101: </a></td><td><span class="php-comment">						$subscription_order_product = $this-&gt;model_checkout_subscription-&gt;getSubscriptionByOrderProductId($value[&#039;order_product_id&#039;]);</span></td></tr><tr id="102" class="source-line"><td><a class="source-lineNum" href="#102">102: </a></td><td><span class="php-comment"></span></td></tr><tr id="103" class="source-line"><td><a class="source-lineNum" href="#103">103: </a></td><td><span class="php-comment">						if ($subscription_order_product) {</span></td></tr><tr id="104" class="source-line"><td><a class="source-lineNum" href="#104">104: </a></td><td><span class="php-comment">							// Orders</span></td></tr><tr id="105" class="source-line"><td><a class="source-lineNum" href="#105">105: </a></td><td><span class="php-comment">							$this-&gt;load-&gt;model(&#039;account/order&#039;);</span></td></tr><tr id="106" class="source-line"><td><a class="source-lineNum" href="#106">106: </a></td><td><span class="php-comment"></span></td></tr><tr id="107" class="source-line"><td><a class="source-lineNum" href="#107">107: </a></td><td><span class="php-comment">							// Order Products</span></td></tr><tr id="108" class="source-line"><td><a class="source-lineNum" href="#108">108: </a></td><td><span class="php-comment">							$order_product = $this-&gt;model_account_order-&gt;getProduct($value[&#039;order_id&#039;], $value[&#039;order_product_id&#039;]);</span></td></tr><tr id="109" class="source-line"><td><a class="source-lineNum" href="#109">109: </a></td><td><span class="php-comment"></span></td></tr><tr id="110" class="source-line"><td><a class="source-lineNum" href="#110">110: </a></td><td><span class="php-comment">							if ($order_product &amp;&amp; $order_product[&#039;order_product_id&#039;] == $subscription[&#039;order_product_id&#039;]) {</span></td></tr><tr id="111" class="source-line"><td><a class="source-lineNum" href="#111">111: </a></td><td><span class="php-comment">								$products = $this-&gt;cart-&gt;getProducts();</span></td></tr><tr id="112" class="source-line"><td><a class="source-lineNum" href="#112">112: </a></td><td><span class="php-comment"></span></td></tr><tr id="113" class="source-line"><td><a class="source-lineNum" href="#113">113: </a></td><td><span class="php-comment">								$description = &#039;&#039;;</span></td></tr><tr id="114" class="source-line"><td><a class="source-lineNum" href="#114">114: </a></td><td><span class="php-comment"></span></td></tr><tr id="115" class="source-line"><td><a class="source-lineNum" href="#115">115: </a></td><td><span class="php-comment">								foreach ($products as $product) {</span></td></tr><tr id="116" class="source-line"><td><a class="source-lineNum" href="#116">116: </a></td><td><span class="php-comment">									if ($product[&#039;product_id&#039;] == $order_product[&#039;product_id&#039;]) {</span></td></tr><tr id="117" class="source-line"><td><a class="source-lineNum" href="#117">117: </a></td><td><span class="php-comment"></span></td></tr><tr id="118" class="source-line"><td><a class="source-lineNum" href="#118">118: </a></td><td><span class="php-comment"></span></td></tr><tr id="119" class="source-line"><td><a class="source-lineNum" href="#119">119: </a></td><td><span class="php-comment">										if ($product[&#039;subscription&#039;][&#039;trial_status&#039;]) {</span></td></tr><tr id="120" class="source-line"><td><a class="source-lineNum" href="#120">120: </a></td><td><span class="php-comment">											$trial_price = $this-&gt;currency-&gt;format($this-&gt;tax-&gt;calculate($value[&#039;trial_price&#039;], $product[&#039;tax_class_id&#039;], $this-&gt;config-&gt;get(&#039;config_tax&#039;)), $this-&gt;config-&gt;get(&#039;config_currency&#039;));</span></td></tr><tr id="121" class="source-line"><td><a class="source-lineNum" href="#121">121: </a></td><td><span class="php-comment">											$trial_cycle = $value[&#039;trial_cycle&#039;];</span></td></tr><tr id="122" class="source-line"><td><a class="source-lineNum" href="#122">122: </a></td><td><span class="php-comment">											$trial_frequency = $this-&gt;language-&gt;get(&#039;text_&#039; . $value[&#039;trial_frequency&#039;]);</span></td></tr><tr id="123" class="source-line"><td><a class="source-lineNum" href="#123">123: </a></td><td><span class="php-comment">											$trial_duration = $value[&#039;trial_duration&#039;];</span></td></tr><tr id="124" class="source-line"><td><a class="source-lineNum" href="#124">124: </a></td><td><span class="php-comment"></span></td></tr><tr id="125" class="source-line"><td><a class="source-lineNum" href="#125">125: </a></td><td><span class="php-comment">											$description .= sprintf($this-&gt;language-&gt;get(&#039;text_subscription_trial&#039;), $trial_price, $trial_cycle, $trial_frequency, $trial_duration);</span></td></tr><tr id="126" class="source-line"><td><a class="source-lineNum" href="#126">126: </a></td><td><span class="php-comment">										}</span></td></tr><tr id="127" class="source-line"><td><a class="source-lineNum" href="#127">127: </a></td><td><span class="php-comment"></span></td></tr><tr id="128" class="source-line"><td><a class="source-lineNum" href="#128">128: </a></td><td><span class="php-comment">										$price = $this-&gt;currency-&gt;format($this-&gt;tax-&gt;calculate($value[&#039;price&#039;], $product[&#039;tax_class_id&#039;], $this-&gt;config-&gt;get(&#039;config_tax&#039;)), $this-&gt;config-&gt;get(&#039;config_currency&#039;));</span></td></tr><tr id="129" class="source-line"><td><a class="source-lineNum" href="#129">129: </a></td><td><span class="php-comment">										$cycle = $value[&#039;cycle&#039;];</span></td></tr><tr id="130" class="source-line"><td><a class="source-lineNum" href="#130">130: </a></td><td><span class="php-comment">										$frequency = $this-&gt;language-&gt;get(&#039;text_&#039; . $value[&#039;frequency&#039;]);</span></td></tr><tr id="131" class="source-line"><td><a class="source-lineNum" href="#131">131: </a></td><td><span class="php-comment">										$duration = $value[&#039;duration&#039;];</span></td></tr><tr id="132" class="source-line"><td><a class="source-lineNum" href="#132">132: </a></td><td><span class="php-comment"></span></td></tr><tr id="133" class="source-line"><td><a class="source-lineNum" href="#133">133: </a></td><td><span class="php-comment">										if ($duration) {</span></td></tr><tr id="134" class="source-line"><td><a class="source-lineNum" href="#134">134: </a></td><td><span class="php-comment">											$description .= sprintf($this-&gt;language-&gt;get(&#039;text_subscription_duration&#039;), $price, $cycle, $frequency, $duration);</span></td></tr><tr id="135" class="source-line"><td><a class="source-lineNum" href="#135">135: </a></td><td><span class="php-comment">										} else {</span></td></tr><tr id="136" class="source-line"><td><a class="source-lineNum" href="#136">136: </a></td><td><span class="php-comment">											$description .= sprintf($this-&gt;language-&gt;get(&#039;text_subscription_cancel&#039;), $price, $cycle, $frequency);</span></td></tr><tr id="137" class="source-line"><td><a class="source-lineNum" href="#137">137: </a></td><td><span class="php-comment">										}</span></td></tr><tr id="138" class="source-line"><td><a class="source-lineNum" href="#138">138: </a></td><td><span class="php-comment">									}</span></td></tr><tr id="139" class="source-line"><td><a class="source-lineNum" href="#139">139: </a></td><td><span class="php-comment">								}</span></td></tr><tr id="140" class="source-line"><td><a class="source-lineNum" href="#140">140: </a></td><td><span class="php-comment"></span></td></tr><tr id="141" class="source-line"><td><a class="source-lineNum" href="#141">141: </a></td><td><span class="php-comment"></span></td></tr><tr id="142" class="source-line"><td><a class="source-lineNum" href="#142">142: </a></td><td><span class="php-comment">								// Orders</span></td></tr><tr id="143" class="source-line"><td><a class="source-lineNum" href="#143">143: </a></td><td><span class="php-comment">								$this-&gt;load-&gt;model(&#039;checkout/order&#039;);</span></td></tr><tr id="144" class="source-line"><td><a class="source-lineNum" href="#144">144: </a></td><td><span class="php-comment"></span></td></tr><tr id="145" class="source-line"><td><a class="source-lineNum" href="#145">145: </a></td><td><span class="php-comment">								$order_info = $this-&gt;model_checkout_order-&gt;getOrder($value[&#039;order_id&#039;]);</span></td></tr><tr id="146" class="source-line"><td><a class="source-lineNum" href="#146">146: </a></td><td><span class="php-comment"></span></td></tr><tr id="147" class="source-line"><td><a class="source-lineNum" href="#147">147: </a></td><td><span class="php-comment">								if ($order_info) {</span></td></tr><tr id="148" class="source-line"><td><a class="source-lineNum" href="#148">148: </a></td><td><span class="php-comment">									// Stores</span></td></tr><tr id="149" class="source-line"><td><a class="source-lineNum" href="#149">149: </a></td><td><span class="php-comment">									$this-&gt;load-&gt;model(&#039;setting/store&#039;);</span></td></tr><tr id="150" class="source-line"><td><a class="source-lineNum" href="#150">150: </a></td><td><span class="php-comment"></span></td></tr><tr id="151" class="source-line"><td><a class="source-lineNum" href="#151">151: </a></td><td><span class="php-comment">									// Settings</span></td></tr><tr id="152" class="source-line"><td><a class="source-lineNum" href="#152">152: </a></td><td><span class="php-comment">									$this-&gt;load-&gt;model(&#039;setting/setting&#039;);</span></td></tr><tr id="153" class="source-line"><td><a class="source-lineNum" href="#153">153: </a></td><td><span class="php-comment"></span></td></tr><tr id="154" class="source-line"><td><a class="source-lineNum" href="#154">154: </a></td><td><span class="php-comment">									$store_info = $this-&gt;model_setting_store-&gt;getStore($order_info[&#039;store_id&#039;]);</span></td></tr><tr id="155" class="source-line"><td><a class="source-lineNum" href="#155">155: </a></td><td><span class="php-comment"></span></td></tr><tr id="156" class="source-line"><td><a class="source-lineNum" href="#156">156: </a></td><td><span class="php-comment">									if ($store_info) {</span></td></tr><tr id="157" class="source-line"><td><a class="source-lineNum" href="#157">157: </a></td><td><span class="php-comment">										$store_logo = html_entity_decode($this-&gt;model_setting_setting-&gt;getValue(&#039;config_logo&#039;, $store_info[&#039;store_id&#039;]), ENT_QUOTES, &#039;UTF-8&#039;);</span></td></tr><tr id="158" class="source-line"><td><a class="source-lineNum" href="#158">158: </a></td><td><span class="php-comment">										$store_name = html_entity_decode($store_info[&#039;name&#039;], ENT_QUOTES, &#039;UTF-8&#039;);</span></td></tr><tr id="159" class="source-line"><td><a class="source-lineNum" href="#159">159: </a></td><td><span class="php-comment"></span></td></tr><tr id="160" class="source-line"><td><a class="source-lineNum" href="#160">160: </a></td><td><span class="php-comment">										$store_url = $store_info[&#039;url&#039;];</span></td></tr><tr id="161" class="source-line"><td><a class="source-lineNum" href="#161">161: </a></td><td><span class="php-comment">									} else {</span></td></tr><tr id="162" class="source-line"><td><a class="source-lineNum" href="#162">162: </a></td><td><span class="php-comment">										$store_logo = html_entity_decode($this-&gt;config-&gt;get(&#039;config_logo&#039;), ENT_QUOTES, &#039;UTF-8&#039;);</span></td></tr><tr id="163" class="source-line"><td><a class="source-lineNum" href="#163">163: </a></td><td><span class="php-comment">										$store_name = html_entity_decode($this-&gt;config-&gt;get(&#039;config_name&#039;), ENT_QUOTES, &#039;UTF-8&#039;);</span></td></tr><tr id="164" class="source-line"><td><a class="source-lineNum" href="#164">164: </a></td><td><span class="php-comment"></span></td></tr><tr id="165" class="source-line"><td><a class="source-lineNum" href="#165">165: </a></td><td><span class="php-comment">										$store_url = HTTP_SERVER;</span></td></tr><tr id="166" class="source-line"><td><a class="source-lineNum" href="#166">166: </a></td><td><span class="php-comment">									}</span></td></tr><tr id="167" class="source-line"><td><a class="source-lineNum" href="#167">167: </a></td><td><span class="php-comment"></span></td></tr><tr id="168" class="source-line"><td><a class="source-lineNum" href="#168">168: </a></td><td><span class="php-comment">									// Subscription Status</span></td></tr><tr id="169" class="source-line"><td><a class="source-lineNum" href="#169">169: </a></td><td><span class="php-comment">									$subscription_status_query = $this-&gt;db-&gt;query(&quot;SELECT * FROM `&quot; . DB_PREFIX . &quot;subscription_status` WHERE `subscription_status_id` = &#039;&quot; . (int)$value[&#039;subscription_status_id&#039;] . &quot;&#039; AND `language_id` = &#039;&quot; . (int)$order_info[&#039;language_id&#039;] . &quot;&#039;&quot;);</span></td></tr><tr id="170" class="source-line"><td><a class="source-lineNum" href="#170">170: </a></td><td><span class="php-comment"></span></td></tr><tr id="171" class="source-line"><td><a class="source-lineNum" href="#171">171: </a></td><td><span class="php-comment">									if ($subscription_status_query-&gt;num_rows) {</span></td></tr><tr id="172" class="source-line"><td><a class="source-lineNum" href="#172">172: </a></td><td><span class="php-comment">										$data[&#039;order_status&#039;] = $subscription_status_query-&gt;row[&#039;name&#039;];</span></td></tr><tr id="173" class="source-line"><td><a class="source-lineNum" href="#173">173: </a></td><td><span class="php-comment">									} else {</span></td></tr><tr id="174" class="source-line"><td><a class="source-lineNum" href="#174">174: </a></td><td><span class="php-comment">										$data[&#039;order_status&#039;] = &#039;&#039;;</span></td></tr><tr id="175" class="source-line"><td><a class="source-lineNum" href="#175">175: </a></td><td><span class="php-comment">									}</span></td></tr><tr id="176" class="source-line"><td><a class="source-lineNum" href="#176">176: </a></td><td><span class="php-comment"></span></td></tr><tr id="177" class="source-line"><td><a class="source-lineNum" href="#177">177: </a></td><td><span class="php-comment">									// Languages</span></td></tr><tr id="178" class="source-line"><td><a class="source-lineNum" href="#178">178: </a></td><td><span class="php-comment">									$this-&gt;load-&gt;model(&#039;localisation/language&#039;);</span></td></tr><tr id="179" class="source-line"><td><a class="source-lineNum" href="#179">179: </a></td><td><span class="php-comment"></span></td></tr><tr id="180" class="source-line"><td><a class="source-lineNum" href="#180">180: </a></td><td><span class="php-comment">									$language_info = $this-&gt;model_localisation_language-&gt;getLanguage($order_info[&#039;language_id&#039;]);</span></td></tr><tr id="181" class="source-line"><td><a class="source-lineNum" href="#181">181: </a></td><td><span class="php-comment"></span></td></tr><tr id="182" class="source-line"><td><a class="source-lineNum" href="#182">182: </a></td><td><span class="php-comment">									// We need to compare both language IDs as they both need to match.</span></td></tr><tr id="183" class="source-line"><td><a class="source-lineNum" href="#183">183: </a></td><td><span class="php-comment">									if ($language_info) {</span></td></tr><tr id="184" class="source-line"><td><a class="source-lineNum" href="#184">184: </a></td><td><span class="php-comment">										$language_code = $language_info[&#039;code&#039;];</span></td></tr><tr id="185" class="source-line"><td><a class="source-lineNum" href="#185">185: </a></td><td><span class="php-comment">									} else {</span></td></tr><tr id="186" class="source-line"><td><a class="source-lineNum" href="#186">186: </a></td><td><span class="php-comment">										$language_code = $this-&gt;config-&gt;get(&#039;config_language&#039;);</span></td></tr><tr id="187" class="source-line"><td><a class="source-lineNum" href="#187">187: </a></td><td><span class="php-comment">									}</span></td></tr><tr id="188" class="source-line"><td><a class="source-lineNum" href="#188">188: </a></td><td><span class="php-comment"></span></td></tr><tr id="189" class="source-line"><td><a class="source-lineNum" href="#189">189: </a></td><td><span class="php-comment">									// Load the language for any mails using a different country code and prefixing it so it does not pollute the main data pool.</span></td></tr><tr id="190" class="source-line"><td><a class="source-lineNum" href="#190">190: </a></td><td><span class="php-comment">									$this-&gt;load-&gt;language(&#039;default&#039;, &#039;mail&#039;, $language_code);</span></td></tr><tr id="191" class="source-line"><td><a class="source-lineNum" href="#191">191: </a></td><td><span class="php-comment">									$this-&gt;load-&gt;language(&#039;mail/order_add&#039;, &#039;mail&#039;, $language_code);</span></td></tr><tr id="192" class="source-line"><td><a class="source-lineNum" href="#192">192: </a></td><td><span class="php-comment"></span></td></tr><tr id="193" class="source-line"><td><a class="source-lineNum" href="#193">193: </a></td><td><span class="php-comment">									// Add language vars to the template folder</span></td></tr><tr id="194" class="source-line"><td><a class="source-lineNum" href="#194">194: </a></td><td><span class="php-comment">									$results = $this-&gt;language-&gt;all(&#039;mail&#039;);</span></td></tr><tr id="195" class="source-line"><td><a class="source-lineNum" href="#195">195: </a></td><td><span class="php-comment"></span></td></tr><tr id="196" class="source-line"><td><a class="source-lineNum" href="#196">196: </a></td><td><span class="php-comment">									foreach ($results as $key =&gt; $value) {</span></td></tr><tr id="197" class="source-line"><td><a class="source-lineNum" href="#197">197: </a></td><td><span class="php-comment">										$data[$key] = $value;</span></td></tr><tr id="198" class="source-line"><td><a class="source-lineNum" href="#198">198: </a></td><td><span class="php-comment">									}</span></td></tr><tr id="199" class="source-line"><td><a class="source-lineNum" href="#199">199: </a></td><td><span class="php-comment"></span></td></tr><tr id="200" class="source-line"><td><a class="source-lineNum" href="#200">200: </a></td><td><span class="php-comment">									$subject = sprintf($this-&gt;language-&gt;get(&#039;mail_text_subject&#039;), $store_name, $order_info[&#039;order_id&#039;]);</span></td></tr><tr id="201" class="source-line"><td><a class="source-lineNum" href="#201">201: </a></td><td><span class="php-comment"></span></td></tr><tr id="202" class="source-line"><td><a class="source-lineNum" href="#202">202: </a></td><td><span class="php-comment">									// Image files</span></td></tr><tr id="203" class="source-line"><td><a class="source-lineNum" href="#203">203: </a></td><td><span class="php-comment">									$this-&gt;load-&gt;model(&#039;tool/image&#039;);</span></td></tr><tr id="204" class="source-line"><td><a class="source-lineNum" href="#204">204: </a></td><td><span class="php-comment"></span></td></tr><tr id="205" class="source-line"><td><a class="source-lineNum" href="#205">205: </a></td><td><span class="php-comment">									if (is_file(DIR_IMAGE . $store_logo)) {</span></td></tr><tr id="206" class="source-line"><td><a class="source-lineNum" href="#206">206: </a></td><td><span class="php-comment">										$data[&#039;logo&#039;] = $store_url . &#039;image/&#039; . $store_logo;</span></td></tr><tr id="207" class="source-line"><td><a class="source-lineNum" href="#207">207: </a></td><td><span class="php-comment">									} else {</span></td></tr><tr id="208" class="source-line"><td><a class="source-lineNum" href="#208">208: </a></td><td><span class="php-comment">										$data[&#039;logo&#039;] = &#039;&#039;;</span></td></tr><tr id="209" class="source-line"><td><a class="source-lineNum" href="#209">209: </a></td><td><span class="php-comment">									}</span></td></tr><tr id="210" class="source-line"><td><a class="source-lineNum" href="#210">210: </a></td><td><span class="php-comment"></span></td></tr><tr id="211" class="source-line"><td><a class="source-lineNum" href="#211">211: </a></td><td><span class="php-comment">									$data[&#039;title&#039;] = sprintf($this-&gt;language-&gt;get(&#039;mail_text_subject&#039;), $store_name, $order_info[&#039;order_id&#039;]);</span></td></tr><tr id="212" class="source-line"><td><a class="source-lineNum" href="#212">212: </a></td><td><span class="php-comment"></span></td></tr><tr id="213" class="source-line"><td><a class="source-lineNum" href="#213">213: </a></td><td><span class="php-comment">									$data[&#039;text_greeting&#039;] = sprintf($this-&gt;language-&gt;get(&#039;mail_text_greeting&#039;), $order_info[&#039;store_name&#039;]);</span></td></tr><tr id="214" class="source-line"><td><a class="source-lineNum" href="#214">214: </a></td><td><span class="php-comment"></span></td></tr><tr id="215" class="source-line"><td><a class="source-lineNum" href="#215">215: </a></td><td><span class="php-comment">									$data[&#039;store&#039;] = $store_name;</span></td></tr><tr id="216" class="source-line"><td><a class="source-lineNum" href="#216">216: </a></td><td><span class="php-comment">									$data[&#039;store_url&#039;] = $order_info[&#039;store_url&#039;];</span></td></tr><tr id="217" class="source-line"><td><a class="source-lineNum" href="#217">217: </a></td><td><span class="php-comment"></span></td></tr><tr id="218" class="source-line"><td><a class="source-lineNum" href="#218">218: </a></td><td><span class="php-comment">									$data[&#039;customer_id&#039;] = $order_info[&#039;customer_id&#039;];</span></td></tr><tr id="219" class="source-line"><td><a class="source-lineNum" href="#219">219: </a></td><td><span class="php-comment">									$data[&#039;link&#039;] = $order_info[&#039;store_url&#039;] . &#039;index.php?route=account/subscription.info&amp;subscription_id=&#039; . $subscription_id;</span></td></tr><tr id="220" class="source-line"><td><a class="source-lineNum" href="#220">220: </a></td><td><span class="php-comment"></span></td></tr><tr id="221" class="source-line"><td><a class="source-lineNum" href="#221">221: </a></td><td><span class="php-comment">									$data[&#039;order_id&#039;] = $order_info[&#039;order_id&#039;];</span></td></tr><tr id="222" class="source-line"><td><a class="source-lineNum" href="#222">222: </a></td><td><span class="php-comment">									$data[&#039;date_added&#039;] = date($this-&gt;language-&gt;get(&#039;date_format_short&#039;), strtotime($value[&#039;date_added&#039;]));</span></td></tr><tr id="223" class="source-line"><td><a class="source-lineNum" href="#223">223: </a></td><td><span class="php-comment">									$data[&#039;payment_method&#039;] = $order_info[&#039;payment_method&#039;];</span></td></tr><tr id="224" class="source-line"><td><a class="source-lineNum" href="#224">224: </a></td><td><span class="php-comment">									$data[&#039;email&#039;] = $order_info[&#039;email&#039;];</span></td></tr><tr id="225" class="source-line"><td><a class="source-lineNum" href="#225">225: </a></td><td><span class="php-comment">									$data[&#039;telephone&#039;] = $order_info[&#039;telephone&#039;];</span></td></tr><tr id="226" class="source-line"><td><a class="source-lineNum" href="#226">226: </a></td><td><span class="php-comment">									$data[&#039;ip&#039;] = $order_info[&#039;ip&#039;];</span></td></tr><tr id="227" class="source-line"><td><a class="source-lineNum" href="#227">227: </a></td><td><span class="php-comment"></span></td></tr><tr id="228" class="source-line"><td><a class="source-lineNum" href="#228">228: </a></td><td><span class="php-comment">									// Order Totals</span></td></tr><tr id="229" class="source-line"><td><a class="source-lineNum" href="#229">229: </a></td><td><span class="php-comment">									$data[&#039;totals&#039;] = [];</span></td></tr><tr id="230" class="source-line"><td><a class="source-lineNum" href="#230">230: </a></td><td><span class="php-comment"></span></td></tr><tr id="231" class="source-line"><td><a class="source-lineNum" href="#231">231: </a></td><td><span class="php-comment">									$order_totals = $this-&gt;model_checkout_order-&gt;getTotals($subscription[&#039;order_id&#039;]);</span></td></tr><tr id="232" class="source-line"><td><a class="source-lineNum" href="#232">232: </a></td><td><span class="php-comment"></span></td></tr><tr id="233" class="source-line"><td><a class="source-lineNum" href="#233">233: </a></td><td><span class="php-comment">									foreach ($order_totals as $order_total) {</span></td></tr><tr id="234" class="source-line"><td><a class="source-lineNum" href="#234">234: </a></td><td><span class="php-comment">										$data[&#039;totals&#039;][] = [</span></td></tr><tr id="235" class="source-line"><td><a class="source-lineNum" href="#235">235: </a></td><td><span class="php-comment">											&#039;title&#039; =&gt; $order_total[&#039;title&#039;],</span></td></tr><tr id="236" class="source-line"><td><a class="source-lineNum" href="#236">236: </a></td><td><span class="php-comment">											&#039;text&#039; =&gt; $this-&gt;currency-&gt;format($order_total[&#039;value&#039;], $order_info[&#039;currency_code&#039;], $order_info[&#039;currency_value&#039;]),</span></td></tr><tr id="237" class="source-line"><td><a class="source-lineNum" href="#237">237: </a></td><td><span class="php-comment">										];</span></td></tr><tr id="238" class="source-line"><td><a class="source-lineNum" href="#238">238: </a></td><td><span class="php-comment">									}</span></td></tr><tr id="239" class="source-line"><td><a class="source-lineNum" href="#239">239: </a></td><td><span class="php-comment"></span></td></tr><tr id="240" class="source-line"><td><a class="source-lineNum" href="#240">240: </a></td><td><span class="php-comment">									// Subscription</span></td></tr><tr id="241" class="source-line"><td><a class="source-lineNum" href="#241">241: </a></td><td><span class="php-comment">									if ($comment &amp;&amp; $notify) {</span></td></tr><tr id="242" class="source-line"><td><a class="source-lineNum" href="#242">242: </a></td><td><span class="php-comment">										$data[&#039;comment&#039;] = nl2br($comment);</span></td></tr><tr id="243" class="source-line"><td><a class="source-lineNum" href="#243">243: </a></td><td><span class="php-comment">									} else {</span></td></tr><tr id="244" class="source-line"><td><a class="source-lineNum" href="#244">244: </a></td><td><span class="php-comment">										$data[&#039;comment&#039;] = &#039;&#039;;</span></td></tr><tr id="245" class="source-line"><td><a class="source-lineNum" href="#245">245: </a></td><td><span class="php-comment">									}</span></td></tr><tr id="246" class="source-line"><td><a class="source-lineNum" href="#246">246: </a></td><td><span class="php-comment"></span></td></tr><tr id="247" class="source-line"><td><a class="source-lineNum" href="#247">247: </a></td><td><span class="php-comment">									$data[&#039;description&#039;] = $value[&#039;description&#039;];</span></td></tr><tr id="248" class="source-line"><td><a class="source-lineNum" href="#248">248: </a></td><td><span class="php-comment"></span></td></tr><tr id="249" class="source-line"><td><a class="source-lineNum" href="#249">249: </a></td><td><span class="php-comment">									// Products</span></td></tr><tr id="250" class="source-line"><td><a class="source-lineNum" href="#250">250: </a></td><td><span class="php-comment">									$data[&#039;name&#039;] = $order_product[&#039;name&#039;];</span></td></tr><tr id="251" class="source-line"><td><a class="source-lineNum" href="#251">251: </a></td><td><span class="php-comment">									$data[&#039;quantity&#039;] = $order_product[&#039;quantity&#039;];</span></td></tr><tr id="252" class="source-line"><td><a class="source-lineNum" href="#252">252: </a></td><td><span class="php-comment">									$data[&#039;price&#039;] = $this-&gt;currency-&gt;format($order_product[&#039;price&#039;], $order_info[&#039;currency_code&#039;], $order_info[&#039;currency_value&#039;]);</span></td></tr><tr id="253" class="source-line"><td><a class="source-lineNum" href="#253">253: </a></td><td><span class="php-comment">									$data[&#039;total&#039;] = $this-&gt;currency-&gt;format($order_product[&#039;total&#039;], $order_info[&#039;currency_code&#039;], $order_info[&#039;currency_value&#039;]);</span></td></tr><tr id="254" class="source-line"><td><a class="source-lineNum" href="#254">254: </a></td><td><span class="php-comment"></span></td></tr><tr id="255" class="source-line"><td><a class="source-lineNum" href="#255">255: </a></td><td><span class="php-comment">									$data[&#039;order&#039;] = $this-&gt;url-&gt;link(&#039;account/order.info&#039;, &#039;order_id=&#039; . $value[&#039;order_id&#039;]);</span></td></tr><tr id="256" class="source-line"><td><a class="source-lineNum" href="#256">256: </a></td><td><span class="php-comment">									$data[&#039;product&#039;] = $this-&gt;url-&gt;link(&#039;product/product&#039;, &#039;product_id=&#039; . $value[&#039;product_id&#039;]);</span></td></tr><tr id="257" class="source-line"><td><a class="source-lineNum" href="#257">257: </a></td><td><span class="php-comment"></span></td></tr><tr id="258" class="source-line"><td><a class="source-lineNum" href="#258">258: </a></td><td><span class="php-comment">									// Settings</span></td></tr><tr id="259" class="source-line"><td><a class="source-lineNum" href="#259">259: </a></td><td><span class="php-comment">									$from = $this-&gt;model_setting_setting-&gt;getValue(&#039;config_email&#039;, $order_info[&#039;store_id&#039;]);</span></td></tr><tr id="260" class="source-line"><td><a class="source-lineNum" href="#260">260: </a></td><td><span class="php-comment"></span></td></tr><tr id="261" class="source-line"><td><a class="source-lineNum" href="#261">261: </a></td><td><span class="php-comment">									if (!$from) {</span></td></tr><tr id="262" class="source-line"><td><a class="source-lineNum" href="#262">262: </a></td><td><span class="php-comment">										$from = $this-&gt;config-&gt;get(&#039;config_email&#039;);</span></td></tr><tr id="263" class="source-line"><td><a class="source-lineNum" href="#263">263: </a></td><td><span class="php-comment">									}</span></td></tr><tr id="264" class="source-line"><td><a class="source-lineNum" href="#264">264: </a></td><td><span class="php-comment"></span></td></tr><tr id="265" class="source-line"><td><a class="source-lineNum" href="#265">265: </a></td><td><span class="php-comment">									if ($this-&gt;config-&gt;get(&#039;payment_&#039; . $payment_info[&#039;code&#039;] . &#039;_status&#039;)) {</span></td></tr><tr id="266" class="source-line"><td><a class="source-lineNum" href="#266">266: </a></td><td><span class="php-comment">										$this-&gt;load-&gt;model(&#039;extension/payment/&#039; . $payment_info[&#039;code&#039;]);</span></td></tr><tr id="267" class="source-line"><td><a class="source-lineNum" href="#267">267: </a></td><td><span class="php-comment"></span></td></tr><tr id="268" class="source-line"><td><a class="source-lineNum" href="#268">268: </a></td><td><span class="php-comment">										// Promotion</span></td></tr><tr id="269" class="source-line"><td><a class="source-lineNum" href="#269">269: </a></td><td><span class="php-comment">										if (isset($this-&gt;{&#039;model_extension_payment_&#039; . $payment_info[&#039;code&#039;]}-&gt;promotion)) {</span></td></tr><tr id="270" class="source-line"><td><a class="source-lineNum" href="#270">270: </a></td><td><span class="php-comment">											$subscription_status_id = $this-&gt;{&#039;model_extension_payment_&#039; . $payment_info[&#039;code&#039;]}-&gt;promotion($value[&#039;subscription_id&#039;]);</span></td></tr><tr id="271" class="source-line"><td><a class="source-lineNum" href="#271">271: </a></td><td><span class="php-comment"></span></td></tr><tr id="272" class="source-line"><td><a class="source-lineNum" href="#272">272: </a></td><td><span class="php-comment">											if ($store_info) {</span></td></tr><tr id="273" class="source-line"><td><a class="source-lineNum" href="#273">273: </a></td><td><span class="php-comment">												$config_subscription_active_status_id = $this-&gt;model_setting_setting-&gt;getValue(&#039;config_subscription_active_status_id&#039;, $store_info[&#039;store_id&#039;]);</span></td></tr><tr id="274" class="source-line"><td><a class="source-lineNum" href="#274">274: </a></td><td><span class="php-comment">											} else {</span></td></tr><tr id="275" class="source-line"><td><a class="source-lineNum" href="#275">275: </a></td><td><span class="php-comment">												$config_subscription_active_status_id = $this-&gt;config-&gt;get(&#039;config_subscription_active_status_id&#039;);</span></td></tr><tr id="276" class="source-line"><td><a class="source-lineNum" href="#276">276: </a></td><td><span class="php-comment">											}</span></td></tr><tr id="277" class="source-line"><td><a class="source-lineNum" href="#277">277: </a></td><td><span class="php-comment"></span></td></tr><tr id="278" class="source-line"><td><a class="source-lineNum" href="#278">278: </a></td><td><span class="php-comment">											if ($config_subscription_active_status_id == $subscription_status_id) {</span></td></tr><tr id="279" class="source-line"><td><a class="source-lineNum" href="#279">279: </a></td><td><span class="php-comment">												$subscription_info = $this-&gt;model_account_subscription-&gt;getSubscription($value[&#039;subscription_id&#039;]);</span></td></tr><tr id="280" class="source-line"><td><a class="source-lineNum" href="#280">280: </a></td><td><span class="php-comment"></span></td></tr><tr id="281" class="source-line"><td><a class="source-lineNum" href="#281">281: </a></td><td><span class="php-comment">												// Validate the latest subscription values with the ones edited</span></td></tr><tr id="282" class="source-line"><td><a class="source-lineNum" href="#282">282: </a></td><td><span class="php-comment">												// by promotional extensions</span></td></tr><tr id="283" class="source-line"><td><a class="source-lineNum" href="#283">283: </a></td><td><span class="php-comment">												if ($subscription_info &amp;&amp; $subscription_info[&#039;status&#039;] &amp;&amp; $subscription_info[&#039;customer_id&#039;] == $value[&#039;customer_id&#039;] &amp;&amp; $subscription_info[&#039;order_id&#039;] == $value[&#039;order_id&#039;] &amp;&amp; $subscription_info[&#039;order_product_id&#039;] == $value[&#039;order_product_id&#039;]) {</span></td></tr><tr id="284" class="source-line"><td><a class="source-lineNum" href="#284">284: </a></td><td><span class="php-comment">													$this-&gt;load-&gt;model(&#039;account/customer&#039;);</span></td></tr><tr id="285" class="source-line"><td><a class="source-lineNum" href="#285">285: </a></td><td><span class="php-comment"></span></td></tr><tr id="286" class="source-line"><td><a class="source-lineNum" href="#286">286: </a></td><td><span class="php-comment">													$customer_info = $this-&gt;model_account_customer-&gt;getCustomer($subscription_info[&#039;customer_id&#039;]);</span></td></tr><tr id="287" class="source-line"><td><a class="source-lineNum" href="#287">287: </a></td><td><span class="php-comment"></span></td></tr><tr id="288" class="source-line"><td><a class="source-lineNum" href="#288">288: </a></td><td><span class="php-comment">													$frequencies = [</span></td></tr><tr id="289" class="source-line"><td><a class="source-lineNum" href="#289">289: </a></td><td><span class="php-comment">														&#039;day&#039;,</span></td></tr><tr id="290" class="source-line"><td><a class="source-lineNum" href="#290">290: </a></td><td><span class="php-comment">														&#039;week&#039;,</span></td></tr><tr id="291" class="source-line"><td><a class="source-lineNum" href="#291">291: </a></td><td><span class="php-comment">														&#039;semi_month&#039;,</span></td></tr><tr id="292" class="source-line"><td><a class="source-lineNum" href="#292">292: </a></td><td><span class="php-comment">														&#039;month&#039;,</span></td></tr><tr id="293" class="source-line"><td><a class="source-lineNum" href="#293">293: </a></td><td><span class="php-comment">														&#039;year&#039;</span></td></tr><tr id="294" class="source-line"><td><a class="source-lineNum" href="#294">294: </a></td><td><span class="php-comment">													];</span></td></tr><tr id="295" class="source-line"><td><a class="source-lineNum" href="#295">295: </a></td><td><span class="php-comment"></span></td></tr><tr id="296" class="source-line"><td><a class="source-lineNum" href="#296">296: </a></td><td><span class="php-comment">													// We need to validate frequencies in compliance of the admin subscription plans</span></td></tr><tr id="297" class="source-line"><td><a class="source-lineNum" href="#297">297: </a></td><td><span class="php-comment">													// as with the use of the APIs</span></td></tr><tr id="298" class="source-line"><td><a class="source-lineNum" href="#298">298: </a></td><td><span class="php-comment">													if ($customer_info &amp;&amp; (int)$subscription_info[&#039;cycle&#039;] &gt;= 0 &amp;&amp; $subscription_info[&#039;cycle&#039;] == $value[&#039;cycle&#039;] &amp;&amp; in_array($subscription_info[&#039;frequency&#039;], $frequencies)) {</span></td></tr><tr id="299" class="source-line"><td><a class="source-lineNum" href="#299">299: </a></td><td><span class="php-comment">														if ($subscription_info[&#039;frequency&#039;] == &#039;semi_month&#039;) {</span></td></tr><tr id="300" class="source-line"><td><a class="source-lineNum" href="#300">300: </a></td><td><span class="php-comment">															$period = strtotime(&quot;2 weeks&quot;);</span></td></tr><tr id="301" class="source-line"><td><a class="source-lineNum" href="#301">301: </a></td><td><span class="php-comment">														} else {</span></td></tr><tr id="302" class="source-line"><td><a class="source-lineNum" href="#302">302: </a></td><td><span class="php-comment">															$period = strtotime($subscription_info[&#039;cycle&#039;] . &#039; &#039; . $subscription_info[&#039;frequency&#039;]);</span></td></tr><tr id="303" class="source-line"><td><a class="source-lineNum" href="#303">303: </a></td><td><span class="php-comment">														}</span></td></tr><tr id="304" class="source-line"><td><a class="source-lineNum" href="#304">304: </a></td><td><span class="php-comment"></span></td></tr><tr id="305" class="source-line"><td><a class="source-lineNum" href="#305">305: </a></td><td><span class="php-comment">														// New customer once the trial period has ended</span></td></tr><tr id="306" class="source-line"><td><a class="source-lineNum" href="#306">306: </a></td><td><span class="php-comment">														$customer_period = strtotime($customer_info[&#039;date_added&#039;]);</span></td></tr><tr id="307" class="source-line"><td><a class="source-lineNum" href="#307">307: </a></td><td><span class="php-comment"></span></td></tr><tr id="308" class="source-line"><td><a class="source-lineNum" href="#308">308: </a></td><td><span class="php-comment">														$trial_period = 0;</span></td></tr><tr id="309" class="source-line"><td><a class="source-lineNum" href="#309">309: </a></td><td><span class="php-comment">														$validate_trial = 0;</span></td></tr><tr id="310" class="source-line"><td><a class="source-lineNum" href="#310">310: </a></td><td><span class="php-comment"></span></td></tr><tr id="311" class="source-line"><td><a class="source-lineNum" href="#311">311: </a></td><td><span class="php-comment">														// Trial</span></td></tr><tr id="312" class="source-line"><td><a class="source-lineNum" href="#312">312: </a></td><td><span class="php-comment">														if ($subscription_info[&#039;trial_cycle&#039;] &amp;&amp; $subscription_info[&#039;trial_frequency&#039;] &amp;&amp; $subscription_info[&#039;trial_cycle&#039;] == $value[&#039;trial_cycle&#039;] &amp;&amp; $subscription_info[&#039;trial_frequency&#039;] == $value[&#039;trial_frequency&#039;]) {</span></td></tr><tr id="313" class="source-line"><td><a class="source-lineNum" href="#313">313: </a></td><td><span class="php-comment">															if ($subscription_info[&#039;trial_frequency&#039;] == &#039;semi_month&#039;) {</span></td></tr><tr id="314" class="source-line"><td><a class="source-lineNum" href="#314">314: </a></td><td><span class="php-comment">																$trial_period = strtotime(&quot;2 weeks&quot;);</span></td></tr><tr id="315" class="source-line"><td><a class="source-lineNum" href="#315">315: </a></td><td><span class="php-comment">															} else {</span></td></tr><tr id="316" class="source-line"><td><a class="source-lineNum" href="#316">316: </a></td><td><span class="php-comment">																$trial_period = strtotime($subscription_info[&#039;trial_cycle&#039;] . &#039; &#039; . $subscription_info[&#039;trial_frequency&#039;]);</span></td></tr><tr id="317" class="source-line"><td><a class="source-lineNum" href="#317">317: </a></td><td><span class="php-comment">															}</span></td></tr><tr id="318" class="source-line"><td><a class="source-lineNum" href="#318">318: </a></td><td><span class="php-comment"></span></td></tr><tr id="319" class="source-line"><td><a class="source-lineNum" href="#319">319: </a></td><td><span class="php-comment">															$trial_period = ($trial_period - $customer_period);</span></td></tr><tr id="320" class="source-line"><td><a class="source-lineNum" href="#320">320: </a></td><td><span class="php-comment">															$validate_trial = round($trial_period / (60 * 60 * 24));</span></td></tr><tr id="321" class="source-line"><td><a class="source-lineNum" href="#321">321: </a></td><td><span class="php-comment">														}</span></td></tr><tr id="322" class="source-line"><td><a class="source-lineNum" href="#322">322: </a></td><td><span class="php-comment"></span></td></tr><tr id="323" class="source-line"><td><a class="source-lineNum" href="#323">323: </a></td><td><span class="php-comment">														// Calculates the remaining days between the subscription</span></td></tr><tr id="324" class="source-line"><td><a class="source-lineNum" href="#324">324: </a></td><td><span class="php-comment">														// promotional period and the date added period</span></td></tr><tr id="325" class="source-line"><td><a class="source-lineNum" href="#325">325: </a></td><td><span class="php-comment">														$period = ($period - $customer_period);</span></td></tr><tr id="326" class="source-line"><td><a class="source-lineNum" href="#326">326: </a></td><td><span class="php-comment"></span></td></tr><tr id="327" class="source-line"><td><a class="source-lineNum" href="#327">327: </a></td><td><span class="php-comment">														// Calculate remaining period of each features</span></td></tr><tr id="328" class="source-line"><td><a class="source-lineNum" href="#328">328: </a></td><td><span class="php-comment">														$period = round($period / (60 * 60 * 24));</span></td></tr><tr id="329" class="source-line"><td><a class="source-lineNum" href="#329">329: </a></td><td><span class="php-comment"></span></td></tr><tr id="330" class="source-line"><td><a class="source-lineNum" href="#330">330: </a></td><td><span class="php-comment">														// Promotional features description must be identical</span></td></tr><tr id="331" class="source-line"><td><a class="source-lineNum" href="#331">331: </a></td><td><span class="php-comment">														// until the time period has exceeded. Therefore, the current</span></td></tr><tr id="332" class="source-line"><td><a class="source-lineNum" href="#332">332: </a></td><td><span class="php-comment">														// period must be matched as well</span></td></tr><tr id="333" class="source-line"><td><a class="source-lineNum" href="#333">333: </a></td><td><span class="php-comment">														if (($period == 0 &amp;&amp; ($validate_trial &gt; 0 || !$validate_trial)) &amp;&amp; $value[&#039;description&#039;] == $description &amp;&amp; $subscription_info[&#039;subscription_plan_id&#039;] == $value[&#039;subscription_plan_id&#039;]) {</span></td></tr><tr id="334" class="source-line"><td><a class="source-lineNum" href="#334">334: </a></td><td><span class="php-comment">															// Products</span></td></tr><tr id="335" class="source-line"><td><a class="source-lineNum" href="#335">335: </a></td><td><span class="php-comment">															$this-&gt;load-&gt;model(&#039;catalog/product&#039;);</span></td></tr><tr id="336" class="source-line"><td><a class="source-lineNum" href="#336">336: </a></td><td><span class="php-comment"></span></td></tr><tr id="337" class="source-line"><td><a class="source-lineNum" href="#337">337: </a></td><td><span class="php-comment">															$product_subscription_info = $this-&gt;model_catalog_product-&gt;getSubscription($order_product[&#039;product_id&#039;], $subscription_info[&#039;subscription_plan_id&#039;]);</span></td></tr><tr id="338" class="source-line"><td><a class="source-lineNum" href="#338">338: </a></td><td><span class="php-comment"></span></td></tr><tr id="339" class="source-line"><td><a class="source-lineNum" href="#339">339: </a></td><td><span class="php-comment">															if ($product_subscription_info) {</span></td></tr><tr id="340" class="source-line"><td><a class="source-lineNum" href="#340">340: </a></td><td><span class="php-comment">																// For the next billing cycle</span></td></tr><tr id="341" class="source-line"><td><a class="source-lineNum" href="#341">341: </a></td><td><span class="php-comment">																$this-&gt;model_account_subscription-&gt;addTransaction($value[&#039;subscription_id&#039;], $value[&#039;order_id&#039;], $this-&gt;language-&gt;get(&#039;text_promotion&#039;), $subscription_info[&#039;amount&#039;], $subscription_info[&#039;type&#039;], $subscription_info[&#039;payment_method&#039;], $subscription_info[&#039;payment_code&#039;]);</span></td></tr><tr id="342" class="source-line"><td><a class="source-lineNum" href="#342">342: </a></td><td><span class="php-comment">															}</span></td></tr><tr id="343" class="source-line"><td><a class="source-lineNum" href="#343">343: </a></td><td><span class="php-comment">														}</span></td></tr><tr id="344" class="source-line"><td><a class="source-lineNum" href="#344">344: </a></td><td><span class="php-comment">													}</span></td></tr><tr id="345" class="source-line"><td><a class="source-lineNum" href="#345">345: </a></td><td><span class="php-comment">												}</span></td></tr><tr id="346" class="source-line"><td><a class="source-lineNum" href="#346">346: </a></td><td><span class="php-comment">											}</span></td></tr><tr id="347" class="source-line"><td><a class="source-lineNum" href="#347">347: </a></td><td><span class="php-comment">										}</span></td></tr><tr id="348" class="source-line"><td><a class="source-lineNum" href="#348">348: </a></td><td><span class="php-comment">									}</span></td></tr><tr id="349" class="source-line"><td><a class="source-lineNum" href="#349">349: </a></td><td><span class="php-comment"></span></td></tr><tr id="350" class="source-line"><td><a class="source-lineNum" href="#350">350: </a></td><td><span class="php-comment">									// Mail</span></td></tr><tr id="351" class="source-line"><td><a class="source-lineNum" href="#351">351: </a></td><td><span class="php-comment">									if ($this-&gt;config-&gt;get(&#039;config_mail_engine&#039;)) {</span></td></tr><tr id="352" class="source-line"><td><a class="source-lineNum" href="#352">352: </a></td><td><span class="php-comment">										$mail_option = [</span></td></tr><tr id="353" class="source-line"><td><a class="source-lineNum" href="#353">353: </a></td><td><span class="php-comment">											&#039;parameter&#039; =&gt; $this-&gt;config-&gt;get(&#039;config_mail_parameter&#039;),</span></td></tr><tr id="354" class="source-line"><td><a class="source-lineNum" href="#354">354: </a></td><td><span class="php-comment">											&#039;smtp_hostname&#039; =&gt; $this-&gt;config-&gt;get(&#039;config_mail_smtp_hostname&#039;),</span></td></tr><tr id="355" class="source-line"><td><a class="source-lineNum" href="#355">355: </a></td><td><span class="php-comment">											&#039;smtp_username&#039; =&gt; $this-&gt;config-&gt;get(&#039;config_mail_smtp_username&#039;),</span></td></tr><tr id="356" class="source-line"><td><a class="source-lineNum" href="#356">356: </a></td><td><span class="php-comment">											&#039;smtp_password&#039; =&gt; html_entity_decode($this-&gt;config-&gt;get(&#039;config_mail_smtp_password&#039;), ENT_QUOTES, &#039;UTF-8&#039;),</span></td></tr><tr id="357" class="source-line"><td><a class="source-lineNum" href="#357">357: </a></td><td><span class="php-comment">											&#039;smtp_port&#039; =&gt; $this-&gt;config-&gt;get(&#039;config_mail_smtp_port&#039;),</span></td></tr><tr id="358" class="source-line"><td><a class="source-lineNum" href="#358">358: </a></td><td><span class="php-comment">											&#039;smtp_timeout&#039; =&gt; $this-&gt;config-&gt;get(&#039;config_mail_smtp_timeout&#039;)</span></td></tr><tr id="359" class="source-line"><td><a class="source-lineNum" href="#359">359: </a></td><td><span class="php-comment">										];</span></td></tr><tr id="360" class="source-line"><td><a class="source-lineNum" href="#360">360: </a></td><td><span class="php-comment"></span></td></tr><tr id="361" class="source-line"><td><a class="source-lineNum" href="#361">361: </a></td><td><span class="php-comment">										$mail = new \Opencart\System\Library\Mail($this-&gt;config-&gt;get(&#039;config_mail_engine&#039;), $mail_option);</span></td></tr><tr id="362" class="source-line"><td><a class="source-lineNum" href="#362">362: </a></td><td><span class="php-comment">										$mail-&gt;setTo($order_info[&#039;email&#039;]);</span></td></tr><tr id="363" class="source-line"><td><a class="source-lineNum" href="#363">363: </a></td><td><span class="php-comment">										$mail-&gt;setFrom($from);</span></td></tr><tr id="364" class="source-line"><td><a class="source-lineNum" href="#364">364: </a></td><td><span class="php-comment">										$mail-&gt;setSender($store_name);</span></td></tr><tr id="365" class="source-line"><td><a class="source-lineNum" href="#365">365: </a></td><td><span class="php-comment">										$mail-&gt;setSubject($subject);</span></td></tr><tr id="366" class="source-line"><td><a class="source-lineNum" href="#366">366: </a></td><td><span class="php-comment">										$mail-&gt;setHtml($this-&gt;load-&gt;view(&#039;mail/subscription&#039;, $data));</span></td></tr><tr id="367" class="source-line"><td><a class="source-lineNum" href="#367">367: </a></td><td><span class="php-comment">										$mail-&gt;send();</span></td></tr><tr id="368" class="source-line"><td><a class="source-lineNum" href="#368">368: </a></td><td><span class="php-comment">									}</span></td></tr><tr id="369" class="source-line"><td><a class="source-lineNum" href="#369">369: </a></td><td><span class="php-comment">								}</span></td></tr><tr id="370" class="source-line"><td><a class="source-lineNum" href="#370">370: </a></td><td><span class="php-comment">							}</span></td></tr><tr id="371" class="source-line"><td><a class="source-lineNum" href="#371">371: </a></td><td><span class="php-comment">						}</span></td></tr><tr id="372" class="source-line"><td><a class="source-lineNum" href="#372">372: </a></td><td><span class="php-comment">					}</span></td></tr><tr id="373" class="source-line"><td><a class="source-lineNum" href="#373">373: </a></td><td><span class="php-comment">				}</span></td></tr><tr id="374" class="source-line"><td><a class="source-lineNum" href="#374">374: </a></td><td><span class="php-comment">			}</span></td></tr><tr id="375" class="source-line"><td><a class="source-lineNum" href="#375">375: </a></td><td><span class="php-comment">		}</span></td></tr><tr id="376" class="source-line"><td><a class="source-lineNum" href="#376">376: </a></td><td><span class="php-comment">		*/</span></td></tr><tr id="377" class="source-line"><td><a class="source-lineNum" href="#377">377: </a></td><td>	}</td></tr><tr id="378" class="source-line"><td><a class="source-lineNum" href="#378">378: </a></td><td></td></tr><tr id="379" class="source-line"><td><a class="source-lineNum" href="#379">379: </a></td><td>	<span class="php-comment">// catalog/model/checkout/order/addHistory/before</span></td></tr><tr id="380" class="source-line"><td><a class="source-lineNum" href="#380">380: </a></td><td></td></tr><tr id="381" class="source-line"><td><a class="source-lineNum" href="#381">381: </a></td><td>	<span class="php-comment">/**</span></td></tr><tr id="382" class="source-line"><td><a class="source-lineNum" href="#382">382: </a></td><td><span class="php-comment">	 * Alert</span></td></tr><tr id="383" class="source-line"><td><a class="source-lineNum" href="#383">383: </a></td><td><span class="php-comment">	 *</span></td></tr><tr id="384" class="source-line"><td><a class="source-lineNum" href="#384">384: </a></td><td><span class="php-comment">	 * @param string            $route</span></td></tr><tr id="385" class="source-line"><td><a class="source-lineNum" href="#385">385: </a></td><td><span class="php-comment">	 * @param array&lt;int, mixed&gt; $args</span></td></tr><tr id="386" class="source-line"><td><a class="source-lineNum" href="#386">386: </a></td><td><span class="php-comment">	 *</span></td></tr><tr id="387" class="source-line"><td><a class="source-lineNum" href="#387">387: </a></td><td><span class="php-comment">	 * @throws \Exception</span></td></tr><tr id="388" class="source-line"><td><a class="source-lineNum" href="#388">388: </a></td><td><span class="php-comment">	 *</span></td></tr><tr id="389" class="source-line"><td><a class="source-lineNum" href="#389">389: </a></td><td><span class="php-comment">	 * @return void</span></td></tr><tr id="390" class="source-line"><td><a class="source-lineNum" href="#390">390: </a></td><td><span class="php-comment">	 */</span></td></tr><tr id="391" class="source-line"><td><a class="source-lineNum" href="#391">391: </a></td><td>	<span class="php-kw">public</span> <span class="php-kw">function</span> alert(string &amp;<span class="php-var">$route</span>, <span class="php-kw">array</span> &amp;<span class="php-var">$args</span>): void {</td></tr><tr id="392" class="source-line"><td><a class="source-lineNum" href="#392">392: </a></td><td>		<span class="php-kw">if</span> (<span class="php-kw">isset</span>(<span class="php-var">$args</span>[<span class="php-num">0</span>])) {</td></tr><tr id="393" class="source-line"><td><a class="source-lineNum" href="#393">393: </a></td><td>			<span class="php-var">$order_id</span> = <span class="php-var">$args</span>[<span class="php-num">0</span>];</td></tr><tr id="394" class="source-line"><td><a class="source-lineNum" href="#394">394: </a></td><td>		} <span class="php-kw">else</span> {</td></tr><tr id="395" class="source-line"><td><a class="source-lineNum" href="#395">395: </a></td><td>			<span class="php-var">$order_id</span> = <span class="php-num">0</span>;</td></tr><tr id="396" class="source-line"><td><a class="source-lineNum" href="#396">396: </a></td><td>		}</td></tr><tr id="397" class="source-line"><td><a class="source-lineNum" href="#397">397: </a></td><td></td></tr><tr id="398" class="source-line"><td><a class="source-lineNum" href="#398">398: </a></td><td>		<span class="php-kw">if</span> (<span class="php-kw">isset</span>(<span class="php-var">$args</span>[<span class="php-num">1</span>])) {</td></tr><tr id="399" class="source-line"><td><a class="source-lineNum" href="#399">399: </a></td><td>			<span class="php-var">$order_status_id</span> = <span class="php-var">$args</span>[<span class="php-num">1</span>];</td></tr><tr id="400" class="source-line"><td><a class="source-lineNum" href="#400">400: </a></td><td>		} <span class="php-kw">else</span> {</td></tr><tr id="401" class="source-line"><td><a class="source-lineNum" href="#401">401: </a></td><td>			<span class="php-var">$order_status_id</span> = <span class="php-num">0</span>;</td></tr><tr id="402" class="source-line"><td><a class="source-lineNum" href="#402">402: </a></td><td>		}</td></tr><tr id="403" class="source-line"><td><a class="source-lineNum" href="#403">403: </a></td><td></td></tr><tr id="404" class="source-line"><td><a class="source-lineNum" href="#404">404: </a></td><td>		<span class="php-kw">if</span> (<span class="php-kw">isset</span>(<span class="php-var">$args</span>[<span class="php-num">2</span>])) {</td></tr><tr id="405" class="source-line"><td><a class="source-lineNum" href="#405">405: </a></td><td>			<span class="php-var">$comment</span> = <span class="php-var">$args</span>[<span class="php-num">2</span>];</td></tr><tr id="406" class="source-line"><td><a class="source-lineNum" href="#406">406: </a></td><td>		} <span class="php-kw">else</span> {</td></tr><tr id="407" class="source-line"><td><a class="source-lineNum" href="#407">407: </a></td><td>			<span class="php-var">$comment</span> = <span class="php-str">&#039;&#039;</span>;</td></tr><tr id="408" class="source-line"><td><a class="source-lineNum" href="#408">408: </a></td><td>		}</td></tr><tr id="409" class="source-line"><td><a class="source-lineNum" href="#409">409: </a></td><td></td></tr><tr id="410" class="source-line"><td><a class="source-lineNum" href="#410">410: </a></td><td>		<span class="php-kw">if</span> (<span class="php-kw">isset</span>(<span class="php-var">$args</span>[<span class="php-num">3</span>])) {</td></tr><tr id="411" class="source-line"><td><a class="source-lineNum" href="#411">411: </a></td><td>			<span class="php-var">$notify</span> = <span class="php-var">$args</span>[<span class="php-num">3</span>];</td></tr><tr id="412" class="source-line"><td><a class="source-lineNum" href="#412">412: </a></td><td>		} <span class="php-kw">else</span> {</td></tr><tr id="413" class="source-line"><td><a class="source-lineNum" href="#413">413: </a></td><td>			<span class="php-var">$notify</span> = <span class="php-str">&#039;&#039;</span>;</td></tr><tr id="414" class="source-line"><td><a class="source-lineNum" href="#414">414: </a></td><td>		}</td></tr><tr id="415" class="source-line"><td><a class="source-lineNum" href="#415">415: </a></td><td></td></tr><tr id="416" class="source-line"><td><a class="source-lineNum" href="#416">416: </a></td><td>		<span class="php-var">$order_info</span> = <span class="php-var">$this</span>-&gt;model_checkout_order-&gt;getOrder(<span class="php-var">$order_id</span>);</td></tr><tr id="417" class="source-line"><td><a class="source-lineNum" href="#417">417: </a></td><td></td></tr><tr id="418" class="source-line"><td><a class="source-lineNum" href="#418">418: </a></td><td>		<span class="php-kw">if</span> (<span class="php-var">$order_info</span> &amp;&amp; !<span class="php-var">$order_info</span>[<span class="php-str">&#039;order_status_id&#039;</span>] &amp;&amp; <span class="php-var">$order_status_id</span> &amp;&amp; in_array(<span class="php-str">&#039;order&#039;</span>, (array)<span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_mail_alert&#039;</span>))) {</td></tr><tr id="419" class="source-line"><td><a class="source-lineNum" href="#419">419: </a></td><td>			<span class="php-var">$this</span>-&gt;load-&gt;language(<span class="php-str">&#039;mail/order_alert&#039;</span>);</td></tr><tr id="420" class="source-line"><td><a class="source-lineNum" href="#420">420: </a></td><td></td></tr><tr id="421" class="source-line"><td><a class="source-lineNum" href="#421">421: </a></td><td>			<span class="php-var">$subject</span> = html_entity_decode(sprintf(<span class="php-var">$this</span>-&gt;language-&gt;get(<span class="php-str">&#039;text_subject&#039;</span>), <span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_name&#039;</span>), <span class="php-var">$order_info</span>[<span class="php-str">&#039;order_id&#039;</span>]), ENT_QUOTES, <span class="php-str">&#039;UTF-8&#039;</span>);</td></tr><tr id="422" class="source-line"><td><a class="source-lineNum" href="#422">422: </a></td><td></td></tr><tr id="423" class="source-line"><td><a class="source-lineNum" href="#423">423: </a></td><td>			<span class="php-var">$data</span>[<span class="php-str">&#039;order_id&#039;</span>] = <span class="php-var">$order_info</span>[<span class="php-str">&#039;order_id&#039;</span>];</td></tr><tr id="424" class="source-line"><td><a class="source-lineNum" href="#424">424: </a></td><td>			<span class="php-var">$data</span>[<span class="php-str">&#039;date_added&#039;</span>] = date(<span class="php-var">$this</span>-&gt;language-&gt;get(<span class="php-str">&#039;date_format_short&#039;</span>), strtotime(<span class="php-var">$order_info</span>[<span class="php-str">&#039;date_added&#039;</span>]));</td></tr><tr id="425" class="source-line"><td><a class="source-lineNum" href="#425">425: </a></td><td></td></tr><tr id="426" class="source-line"><td><a class="source-lineNum" href="#426">426: </a></td><td>			<span class="php-var">$order_status_query</span> = <span class="php-var">$this</span>-&gt;db-&gt;query(<span class="php-str">&quot;SELECT * FROM `&quot;</span> . DB_PREFIX . <span class="php-str">&quot;order_status` WHERE `order_status_id` = &#039;&quot;</span> . (int)<span class="php-var">$order_status_id</span> . <span class="php-str">&quot;&#039; AND `language_id` = &#039;&quot;</span> . (int)<span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_language_id&#039;</span>) . <span class="php-str">&quot;&#039;&quot;</span>);</td></tr><tr id="427" class="source-line"><td><a class="source-lineNum" href="#427">427: </a></td><td></td></tr><tr id="428" class="source-line"><td><a class="source-lineNum" href="#428">428: </a></td><td>			<span class="php-kw">if</span> (<span class="php-var">$order_status_query</span>-&gt;num_rows) {</td></tr><tr id="429" class="source-line"><td><a class="source-lineNum" href="#429">429: </a></td><td>				<span class="php-var">$data</span>[<span class="php-str">&#039;order_status&#039;</span>] = <span class="php-var">$order_status_query</span>-&gt;row[<span class="php-str">&#039;name&#039;</span>];</td></tr><tr id="430" class="source-line"><td><a class="source-lineNum" href="#430">430: </a></td><td>			} <span class="php-kw">else</span> {</td></tr><tr id="431" class="source-line"><td><a class="source-lineNum" href="#431">431: </a></td><td>				<span class="php-var">$data</span>[<span class="php-str">&#039;order_status&#039;</span>] = <span class="php-str">&#039;&#039;</span>;</td></tr><tr id="432" class="source-line"><td><a class="source-lineNum" href="#432">432: </a></td><td>			}</td></tr><tr id="433" class="source-line"><td><a class="source-lineNum" href="#433">433: </a></td><td></td></tr><tr id="434" class="source-line"><td><a class="source-lineNum" href="#434">434: </a></td><td>			<span class="php-var">$this</span>-&gt;load-&gt;model(<span class="php-str">&#039;tool/upload&#039;</span>);</td></tr><tr id="435" class="source-line"><td><a class="source-lineNum" href="#435">435: </a></td><td></td></tr><tr id="436" class="source-line"><td><a class="source-lineNum" href="#436">436: </a></td><td>			<span class="php-var">$data</span>[<span class="php-str">&#039;products&#039;</span>] = [];</td></tr><tr id="437" class="source-line"><td><a class="source-lineNum" href="#437">437: </a></td><td></td></tr><tr id="438" class="source-line"><td><a class="source-lineNum" href="#438">438: </a></td><td>			<span class="php-var">$order_products</span> = <span class="php-var">$this</span>-&gt;model_checkout_order-&gt;getProducts(<span class="php-var">$order_id</span>);</td></tr><tr id="439" class="source-line"><td><a class="source-lineNum" href="#439">439: </a></td><td></td></tr><tr id="440" class="source-line"><td><a class="source-lineNum" href="#440">440: </a></td><td>			<span class="php-kw">foreach</span> (<span class="php-var">$order_products</span> <span class="php-kw">as</span> <span class="php-var">$order_product</span>) {</td></tr><tr id="441" class="source-line"><td><a class="source-lineNum" href="#441">441: </a></td><td>				<span class="php-var">$option_data</span> = [];</td></tr><tr id="442" class="source-line"><td><a class="source-lineNum" href="#442">442: </a></td><td></td></tr><tr id="443" class="source-line"><td><a class="source-lineNum" href="#443">443: </a></td><td>				<span class="php-var">$order_options</span> = <span class="php-var">$this</span>-&gt;model_checkout_order-&gt;getOptions(<span class="php-var">$order_info</span>[<span class="php-str">&#039;order_id&#039;</span>], <span class="php-var">$order_product</span>[<span class="php-str">&#039;order_product_id&#039;</span>]);</td></tr><tr id="444" class="source-line"><td><a class="source-lineNum" href="#444">444: </a></td><td></td></tr><tr id="445" class="source-line"><td><a class="source-lineNum" href="#445">445: </a></td><td>				<span class="php-kw">foreach</span> (<span class="php-var">$order_options</span> <span class="php-kw">as</span> <span class="php-var">$order_option</span>) {</td></tr><tr id="446" class="source-line"><td><a class="source-lineNum" href="#446">446: </a></td><td>					<span class="php-kw">if</span> (<span class="php-var">$order_option</span>[<span class="php-str">&#039;type&#039;</span>] != <span class="php-str">&#039;file&#039;</span>) {</td></tr><tr id="447" class="source-line"><td><a class="source-lineNum" href="#447">447: </a></td><td>						<span class="php-var">$value</span> = <span class="php-var">$order_option</span>[<span class="php-str">&#039;value&#039;</span>];</td></tr><tr id="448" class="source-line"><td><a class="source-lineNum" href="#448">448: </a></td><td>					} <span class="php-kw">else</span> {</td></tr><tr id="449" class="source-line"><td><a class="source-lineNum" href="#449">449: </a></td><td>						<span class="php-var">$upload_info</span> = <span class="php-var">$this</span>-&gt;model_tool_upload-&gt;getUploadByCode(<span class="php-var">$order_option</span>[<span class="php-str">&#039;value&#039;</span>]);</td></tr><tr id="450" class="source-line"><td><a class="source-lineNum" href="#450">450: </a></td><td></td></tr><tr id="451" class="source-line"><td><a class="source-lineNum" href="#451">451: </a></td><td>						<span class="php-kw">if</span> (<span class="php-var">$upload_info</span>) {</td></tr><tr id="452" class="source-line"><td><a class="source-lineNum" href="#452">452: </a></td><td>							<span class="php-var">$value</span> = <span class="php-var">$upload_info</span>[<span class="php-str">&#039;name&#039;</span>];</td></tr><tr id="453" class="source-line"><td><a class="source-lineNum" href="#453">453: </a></td><td>						} <span class="php-kw">else</span> {</td></tr><tr id="454" class="source-line"><td><a class="source-lineNum" href="#454">454: </a></td><td>							<span class="php-var">$value</span> = <span class="php-str">&#039;&#039;</span>;</td></tr><tr id="455" class="source-line"><td><a class="source-lineNum" href="#455">455: </a></td><td>						}</td></tr><tr id="456" class="source-line"><td><a class="source-lineNum" href="#456">456: </a></td><td>					}</td></tr><tr id="457" class="source-line"><td><a class="source-lineNum" href="#457">457: </a></td><td></td></tr><tr id="458" class="source-line"><td><a class="source-lineNum" href="#458">458: </a></td><td>					<span class="php-var">$option_data</span>[] = [</td></tr><tr id="459" class="source-line"><td><a class="source-lineNum" href="#459">459: </a></td><td>						<span class="php-str">&#039;name&#039;</span>  =&gt; <span class="php-var">$order_option</span>[<span class="php-str">&#039;name&#039;</span>],</td></tr><tr id="460" class="source-line"><td><a class="source-lineNum" href="#460">460: </a></td><td>						<span class="php-str">&#039;value&#039;</span> =&gt; (oc_strlen(<span class="php-var">$value</span>) &gt; <span class="php-num">20</span> ? oc_substr(<span class="php-var">$value</span>, <span class="php-num">0</span>, <span class="php-num">20</span>) . <span class="php-str">&#039;..&#039;</span> : <span class="php-var">$value</span>)</td></tr><tr id="461" class="source-line"><td><a class="source-lineNum" href="#461">461: </a></td><td>					];</td></tr><tr id="462" class="source-line"><td><a class="source-lineNum" href="#462">462: </a></td><td>				}</td></tr><tr id="463" class="source-line"><td><a class="source-lineNum" href="#463">463: </a></td><td></td></tr><tr id="464" class="source-line"><td><a class="source-lineNum" href="#464">464: </a></td><td>				<span class="php-var">$description</span> = <span class="php-str">&#039;&#039;</span>;</td></tr><tr id="465" class="source-line"><td><a class="source-lineNum" href="#465">465: </a></td><td></td></tr><tr id="466" class="source-line"><td><a class="source-lineNum" href="#466">466: </a></td><td>				<span class="php-var">$this</span>-&gt;load-&gt;model(<span class="php-str">&#039;checkout/subscription&#039;</span>);</td></tr><tr id="467" class="source-line"><td><a class="source-lineNum" href="#467">467: </a></td><td></td></tr><tr id="468" class="source-line"><td><a class="source-lineNum" href="#468">468: </a></td><td>				<span class="php-var">$subscription_info</span> = <span class="php-var">$this</span>-&gt;model_checkout_order-&gt;getSubscription(<span class="php-var">$order_info</span>[<span class="php-str">&#039;order_id&#039;</span>], <span class="php-var">$order_product</span>[<span class="php-str">&#039;order_product_id&#039;</span>]);</td></tr><tr id="469" class="source-line"><td><a class="source-lineNum" href="#469">469: </a></td><td></td></tr><tr id="470" class="source-line"><td><a class="source-lineNum" href="#470">470: </a></td><td>				<span class="php-kw">if</span> (<span class="php-var">$subscription_info</span>) {</td></tr><tr id="471" class="source-line"><td><a class="source-lineNum" href="#471">471: </a></td><td>					<span class="php-kw">if</span> (<span class="php-var">$subscription_info</span>[<span class="php-str">&#039;trial_status&#039;</span>]) {</td></tr><tr id="472" class="source-line"><td><a class="source-lineNum" href="#472">472: </a></td><td>						<span class="php-var">$trial_price</span> = <span class="php-var">$this</span>-&gt;currency-&gt;format(<span class="php-var">$subscription_info</span>[<span class="php-str">&#039;trial_price&#039;</span>] + (<span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_tax&#039;</span>) ? <span class="php-var">$subscription_info</span>[<span class="php-str">&#039;trial_tax&#039;</span>] : <span class="php-num">0</span>), <span class="php-var">$this</span>-&gt;session-&gt;data[<span class="php-str">&#039;currency&#039;</span>]);</td></tr><tr id="473" class="source-line"><td><a class="source-lineNum" href="#473">473: </a></td><td>						<span class="php-var">$trial_cycle</span> = <span class="php-var">$subscription_info</span>[<span class="php-str">&#039;trial_cycle&#039;</span>];</td></tr><tr id="474" class="source-line"><td><a class="source-lineNum" href="#474">474: </a></td><td>						<span class="php-var">$trial_frequency</span> = <span class="php-var">$this</span>-&gt;language-&gt;get(<span class="php-str">&#039;text_&#039;</span> . <span class="php-var">$subscription_info</span>[<span class="php-str">&#039;trial_frequency&#039;</span>]);</td></tr><tr id="475" class="source-line"><td><a class="source-lineNum" href="#475">475: </a></td><td>						<span class="php-var">$trial_duration</span> = <span class="php-var">$subscription_info</span>[<span class="php-str">&#039;trial_duration&#039;</span>];</td></tr><tr id="476" class="source-line"><td><a class="source-lineNum" href="#476">476: </a></td><td></td></tr><tr id="477" class="source-line"><td><a class="source-lineNum" href="#477">477: </a></td><td>						<span class="php-var">$description</span> .= sprintf(<span class="php-var">$this</span>-&gt;language-&gt;get(<span class="php-str">&#039;text_subscription_trial&#039;</span>), <span class="php-var">$trial_price</span>, <span class="php-var">$trial_cycle</span>, <span class="php-var">$trial_frequency</span>, <span class="php-var">$trial_duration</span>);</td></tr><tr id="478" class="source-line"><td><a class="source-lineNum" href="#478">478: </a></td><td>					}</td></tr><tr id="479" class="source-line"><td><a class="source-lineNum" href="#479">479: </a></td><td></td></tr><tr id="480" class="source-line"><td><a class="source-lineNum" href="#480">480: </a></td><td>					<span class="php-var">$price</span> = <span class="php-var">$this</span>-&gt;currency-&gt;format(<span class="php-var">$subscription_info</span>[<span class="php-str">&#039;price&#039;</span>] + (<span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_tax&#039;</span>) ? <span class="php-var">$subscription_info</span>[<span class="php-str">&#039;tax&#039;</span>] : <span class="php-num">0</span>), <span class="php-var">$this</span>-&gt;session-&gt;data[<span class="php-str">&#039;currency&#039;</span>]);</td></tr><tr id="481" class="source-line"><td><a class="source-lineNum" href="#481">481: </a></td><td>					<span class="php-var">$cycle</span> = <span class="php-var">$subscription_info</span>[<span class="php-str">&#039;cycle&#039;</span>];</td></tr><tr id="482" class="source-line"><td><a class="source-lineNum" href="#482">482: </a></td><td>					<span class="php-var">$frequency</span> = <span class="php-var">$this</span>-&gt;language-&gt;get(<span class="php-str">&#039;text_&#039;</span> . <span class="php-var">$subscription_info</span>[<span class="php-str">&#039;frequency&#039;</span>]);</td></tr><tr id="483" class="source-line"><td><a class="source-lineNum" href="#483">483: </a></td><td>					<span class="php-var">$duration</span> = <span class="php-var">$subscription_info</span>[<span class="php-str">&#039;duration&#039;</span>];</td></tr><tr id="484" class="source-line"><td><a class="source-lineNum" href="#484">484: </a></td><td></td></tr><tr id="485" class="source-line"><td><a class="source-lineNum" href="#485">485: </a></td><td>					<span class="php-kw">if</span> (<span class="php-var">$duration</span>) {</td></tr><tr id="486" class="source-line"><td><a class="source-lineNum" href="#486">486: </a></td><td>						<span class="php-var">$description</span> .= sprintf(<span class="php-var">$this</span>-&gt;language-&gt;get(<span class="php-str">&#039;text_subscription_duration&#039;</span>), <span class="php-var">$price</span>, <span class="php-var">$cycle</span>, <span class="php-var">$frequency</span>, <span class="php-var">$duration</span>);</td></tr><tr id="487" class="source-line"><td><a class="source-lineNum" href="#487">487: </a></td><td>					} <span class="php-kw">else</span> {</td></tr><tr id="488" class="source-line"><td><a class="source-lineNum" href="#488">488: </a></td><td>						<span class="php-var">$description</span> .= sprintf(<span class="php-var">$this</span>-&gt;language-&gt;get(<span class="php-str">&#039;text_subscription_cancel&#039;</span>), <span class="php-var">$price</span>, <span class="php-var">$cycle</span>, <span class="php-var">$frequency</span>);</td></tr><tr id="489" class="source-line"><td><a class="source-lineNum" href="#489">489: </a></td><td>					}</td></tr><tr id="490" class="source-line"><td><a class="source-lineNum" href="#490">490: </a></td><td>				}</td></tr><tr id="491" class="source-line"><td><a class="source-lineNum" href="#491">491: </a></td><td></td></tr><tr id="492" class="source-line"><td><a class="source-lineNum" href="#492">492: </a></td><td>				<span class="php-var">$data</span>[<span class="php-str">&#039;products&#039;</span>][] = [</td></tr><tr id="493" class="source-line"><td><a class="source-lineNum" href="#493">493: </a></td><td>					<span class="php-str">&#039;name&#039;</span>         =&gt; <span class="php-var">$order_product</span>[<span class="php-str">&#039;name&#039;</span>],</td></tr><tr id="494" class="source-line"><td><a class="source-lineNum" href="#494">494: </a></td><td>					<span class="php-str">&#039;model&#039;</span>        =&gt; <span class="php-var">$order_product</span>[<span class="php-str">&#039;model&#039;</span>],</td></tr><tr id="495" class="source-line"><td><a class="source-lineNum" href="#495">495: </a></td><td>					<span class="php-str">&#039;quantity&#039;</span>     =&gt; <span class="php-var">$order_product</span>[<span class="php-str">&#039;quantity&#039;</span>],</td></tr><tr id="496" class="source-line"><td><a class="source-lineNum" href="#496">496: </a></td><td>					<span class="php-str">&#039;option&#039;</span>       =&gt; <span class="php-var">$option_data</span>,</td></tr><tr id="497" class="source-line"><td><a class="source-lineNum" href="#497">497: </a></td><td>					<span class="php-str">&#039;subscription&#039;</span> =&gt; <span class="php-var">$description</span>,</td></tr><tr id="498" class="source-line"><td><a class="source-lineNum" href="#498">498: </a></td><td>					<span class="php-str">&#039;total&#039;</span>        =&gt; html_entity_decode(<span class="php-var">$this</span>-&gt;currency-&gt;format(<span class="php-var">$order_product</span>[<span class="php-str">&#039;total&#039;</span>] + (<span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_tax&#039;</span>) ? <span class="php-var">$order_product</span>[<span class="php-str">&#039;tax&#039;</span>] * <span class="php-var">$order_product</span>[<span class="php-str">&#039;quantity&#039;</span>] : <span class="php-num">0</span>), <span class="php-var">$order_info</span>[<span class="php-str">&#039;currency_code&#039;</span>], <span class="php-var">$order_info</span>[<span class="php-str">&#039;currency_value&#039;</span>]), ENT_NOQUOTES, <span class="php-str">&#039;UTF-8&#039;</span>)</td></tr><tr id="499" class="source-line"><td><a class="source-lineNum" href="#499">499: </a></td><td>				];</td></tr><tr id="500" class="source-line"><td><a class="source-lineNum" href="#500">500: </a></td><td>			}</td></tr><tr id="501" class="source-line"><td><a class="source-lineNum" href="#501">501: </a></td><td></td></tr><tr id="502" class="source-line"><td><a class="source-lineNum" href="#502">502: </a></td><td>			<span class="php-var">$data</span>[<span class="php-str">&#039;vouchers&#039;</span>] = [];</td></tr><tr id="503" class="source-line"><td><a class="source-lineNum" href="#503">503: </a></td><td></td></tr><tr id="504" class="source-line"><td><a class="source-lineNum" href="#504">504: </a></td><td>			<span class="php-var">$order_vouchers</span> = <span class="php-var">$this</span>-&gt;model_checkout_order-&gt;getVouchers(<span class="php-var">$order_id</span>);</td></tr><tr id="505" class="source-line"><td><a class="source-lineNum" href="#505">505: </a></td><td></td></tr><tr id="506" class="source-line"><td><a class="source-lineNum" href="#506">506: </a></td><td>			<span class="php-kw">foreach</span> (<span class="php-var">$order_vouchers</span> <span class="php-kw">as</span> <span class="php-var">$order_voucher</span>) {</td></tr><tr id="507" class="source-line"><td><a class="source-lineNum" href="#507">507: </a></td><td>				<span class="php-var">$data</span>[<span class="php-str">&#039;vouchers&#039;</span>][] = [</td></tr><tr id="508" class="source-line"><td><a class="source-lineNum" href="#508">508: </a></td><td>					<span class="php-str">&#039;description&#039;</span> =&gt; <span class="php-var">$order_voucher</span>[<span class="php-str">&#039;description&#039;</span>],</td></tr><tr id="509" class="source-line"><td><a class="source-lineNum" href="#509">509: </a></td><td>					<span class="php-str">&#039;amount&#039;</span>      =&gt; html_entity_decode(<span class="php-var">$this</span>-&gt;currency-&gt;format(<span class="php-var">$order_voucher</span>[<span class="php-str">&#039;amount&#039;</span>], <span class="php-var">$order_info</span>[<span class="php-str">&#039;currency_code&#039;</span>], <span class="php-var">$order_info</span>[<span class="php-str">&#039;currency_value&#039;</span>]), ENT_NOQUOTES, <span class="php-str">&#039;UTF-8&#039;</span>)</td></tr><tr id="510" class="source-line"><td><a class="source-lineNum" href="#510">510: </a></td><td>				];</td></tr><tr id="511" class="source-line"><td><a class="source-lineNum" href="#511">511: </a></td><td>			}</td></tr><tr id="512" class="source-line"><td><a class="source-lineNum" href="#512">512: </a></td><td></td></tr><tr id="513" class="source-line"><td><a class="source-lineNum" href="#513">513: </a></td><td>			<span class="php-var">$data</span>[<span class="php-str">&#039;totals&#039;</span>] = [];</td></tr><tr id="514" class="source-line"><td><a class="source-lineNum" href="#514">514: </a></td><td></td></tr><tr id="515" class="source-line"><td><a class="source-lineNum" href="#515">515: </a></td><td>			<span class="php-var">$order_totals</span> = <span class="php-var">$this</span>-&gt;model_checkout_order-&gt;getTotals(<span class="php-var">$order_id</span>);</td></tr><tr id="516" class="source-line"><td><a class="source-lineNum" href="#516">516: </a></td><td></td></tr><tr id="517" class="source-line"><td><a class="source-lineNum" href="#517">517: </a></td><td>			<span class="php-kw">foreach</span> (<span class="php-var">$order_totals</span> <span class="php-kw">as</span> <span class="php-var">$order_total</span>) {</td></tr><tr id="518" class="source-line"><td><a class="source-lineNum" href="#518">518: </a></td><td>				<span class="php-var">$data</span>[<span class="php-str">&#039;totals&#039;</span>][] = [</td></tr><tr id="519" class="source-line"><td><a class="source-lineNum" href="#519">519: </a></td><td>					<span class="php-str">&#039;title&#039;</span> =&gt; <span class="php-var">$order_total</span>[<span class="php-str">&#039;title&#039;</span>],</td></tr><tr id="520" class="source-line"><td><a class="source-lineNum" href="#520">520: </a></td><td>					<span class="php-str">&#039;value&#039;</span> =&gt; html_entity_decode(<span class="php-var">$this</span>-&gt;currency-&gt;format(<span class="php-var">$order_total</span>[<span class="php-str">&#039;value&#039;</span>], <span class="php-var">$order_info</span>[<span class="php-str">&#039;currency_code&#039;</span>], <span class="php-var">$order_info</span>[<span class="php-str">&#039;currency_value&#039;</span>]), ENT_NOQUOTES, <span class="php-str">&#039;UTF-8&#039;</span>)</td></tr><tr id="521" class="source-line"><td><a class="source-lineNum" href="#521">521: </a></td><td>				];</td></tr><tr id="522" class="source-line"><td><a class="source-lineNum" href="#522">522: </a></td><td>			}</td></tr><tr id="523" class="source-line"><td><a class="source-lineNum" href="#523">523: </a></td><td></td></tr><tr id="524" class="source-line"><td><a class="source-lineNum" href="#524">524: </a></td><td>			<span class="php-var">$data</span>[<span class="php-str">&#039;comment&#039;</span>] = nl2br(<span class="php-var">$order_info</span>[<span class="php-str">&#039;comment&#039;</span>]);</td></tr><tr id="525" class="source-line"><td><a class="source-lineNum" href="#525">525: </a></td><td></td></tr><tr id="526" class="source-line"><td><a class="source-lineNum" href="#526">526: </a></td><td>			<span class="php-var">$data</span>[<span class="php-str">&#039;store&#039;</span>] = html_entity_decode(<span class="php-var">$order_info</span>[<span class="php-str">&#039;store_name&#039;</span>], ENT_QUOTES, <span class="php-str">&#039;UTF-8&#039;</span>);</td></tr><tr id="527" class="source-line"><td><a class="source-lineNum" href="#527">527: </a></td><td>			<span class="php-var">$data</span>[<span class="php-str">&#039;store_url&#039;</span>] = <span class="php-var">$order_info</span>[<span class="php-str">&#039;store_url&#039;</span>];</td></tr><tr id="528" class="source-line"><td><a class="source-lineNum" href="#528">528: </a></td><td></td></tr><tr id="529" class="source-line"><td><a class="source-lineNum" href="#529">529: </a></td><td>			<span class="php-kw">if</span> (<span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_mail_engine&#039;</span>)) {</td></tr><tr id="530" class="source-line"><td><a class="source-lineNum" href="#530">530: </a></td><td>				<span class="php-var">$mail_option</span> = [</td></tr><tr id="531" class="source-line"><td><a class="source-lineNum" href="#531">531: </a></td><td>					<span class="php-str">&#039;parameter&#039;</span>     =&gt; <span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_mail_parameter&#039;</span>),</td></tr><tr id="532" class="source-line"><td><a class="source-lineNum" href="#532">532: </a></td><td>					<span class="php-str">&#039;smtp_hostname&#039;</span> =&gt; <span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_mail_smtp_hostname&#039;</span>),</td></tr><tr id="533" class="source-line"><td><a class="source-lineNum" href="#533">533: </a></td><td>					<span class="php-str">&#039;smtp_username&#039;</span> =&gt; <span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_mail_smtp_username&#039;</span>),</td></tr><tr id="534" class="source-line"><td><a class="source-lineNum" href="#534">534: </a></td><td>					<span class="php-str">&#039;smtp_password&#039;</span> =&gt; html_entity_decode(<span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_mail_smtp_password&#039;</span>), ENT_QUOTES, <span class="php-str">&#039;UTF-8&#039;</span>),</td></tr><tr id="535" class="source-line"><td><a class="source-lineNum" href="#535">535: </a></td><td>					<span class="php-str">&#039;smtp_port&#039;</span>     =&gt; <span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_mail_smtp_port&#039;</span>),</td></tr><tr id="536" class="source-line"><td><a class="source-lineNum" href="#536">536: </a></td><td>					<span class="php-str">&#039;smtp_timeout&#039;</span>  =&gt; <span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_mail_smtp_timeout&#039;</span>)</td></tr><tr id="537" class="source-line"><td><a class="source-lineNum" href="#537">537: </a></td><td>				];</td></tr><tr id="538" class="source-line"><td><a class="source-lineNum" href="#538">538: </a></td><td></td></tr><tr id="539" class="source-line"><td><a class="source-lineNum" href="#539">539: </a></td><td>				<span class="php-var">$mail</span> = <span class="php-kw">new</span> \Opencart\System\Library\Mail(<span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_mail_engine&#039;</span>), <span class="php-var">$mail_option</span>);</td></tr><tr id="540" class="source-line"><td><a class="source-lineNum" href="#540">540: </a></td><td>				<span class="php-var">$mail</span>-&gt;setTo(<span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_email&#039;</span>));</td></tr><tr id="541" class="source-line"><td><a class="source-lineNum" href="#541">541: </a></td><td>				<span class="php-var">$mail</span>-&gt;setFrom(<span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_email&#039;</span>));</td></tr><tr id="542" class="source-line"><td><a class="source-lineNum" href="#542">542: </a></td><td>				<span class="php-var">$mail</span>-&gt;setSender(html_entity_decode(<span class="php-var">$order_info</span>[<span class="php-str">&#039;store_name&#039;</span>], ENT_QUOTES, <span class="php-str">&#039;UTF-8&#039;</span>));</td></tr><tr id="543" class="source-line"><td><a class="source-lineNum" href="#543">543: </a></td><td>				<span class="php-var">$mail</span>-&gt;setSubject(<span class="php-var">$subject</span>);</td></tr><tr id="544" class="source-line"><td><a class="source-lineNum" href="#544">544: </a></td><td>				<span class="php-var">$mail</span>-&gt;setHtml(<span class="php-var">$this</span>-&gt;load-&gt;view(<span class="php-str">&#039;mail/order_alert&#039;</span>, <span class="php-var">$data</span>));</td></tr><tr id="545" class="source-line"><td><a class="source-lineNum" href="#545">545: </a></td><td>				<span class="php-var">$mail</span>-&gt;send();</td></tr><tr id="546" class="source-line"><td><a class="source-lineNum" href="#546">546: </a></td><td></td></tr><tr id="547" class="source-line"><td><a class="source-lineNum" href="#547">547: </a></td><td>				<span class="php-comment">// Send to additional alert emails</span></td></tr><tr id="548" class="source-line"><td><a class="source-lineNum" href="#548">548: </a></td><td>				<span class="php-var">$emails</span> = explode(<span class="php-str">&#039;,&#039;</span>, <span class="php-var">$this</span>-&gt;config-&gt;get(<span class="php-str">&#039;config_mail_alert_email&#039;</span>));</td></tr><tr id="549" class="source-line"><td><a class="source-lineNum" href="#549">549: </a></td><td></td></tr><tr id="550" class="source-line"><td><a class="source-lineNum" href="#550">550: </a></td><td>				<span class="php-kw">foreach</span> (<span class="php-var">$emails</span> <span class="php-kw">as</span> <span class="php-var">$email</span>) {</td></tr><tr id="551" class="source-line"><td><a class="source-lineNum" href="#551">551: </a></td><td>					<span class="php-kw">if</span> (<span class="php-var">$email</span> &amp;&amp; filter_var(<span class="php-var">$email</span>, FILTER_VALIDATE_EMAIL)) {</td></tr><tr id="552" class="source-line"><td><a class="source-lineNum" href="#552">552: </a></td><td>						<span class="php-var">$mail</span>-&gt;setTo(trim(<span class="php-var">$email</span>));</td></tr><tr id="553" class="source-line"><td><a class="source-lineNum" href="#553">553: </a></td><td>						<span class="php-var">$mail</span>-&gt;send();</td></tr><tr id="554" class="source-line"><td><a class="source-lineNum" href="#554">554: </a></td><td>					}</td></tr><tr id="555" class="source-line"><td><a class="source-lineNum" href="#555">555: </a></td><td>				}</td></tr><tr id="556" class="source-line"><td><a class="source-lineNum" href="#556">556: </a></td><td>			}</td></tr><tr id="557" class="source-line"><td><a class="source-lineNum" href="#557">557: </a></td><td>		}</td></tr><tr id="558" class="source-line"><td><a class="source-lineNum" href="#558">558: </a></td><td>	}</td></tr><tr id="559" class="source-line"><td><a class="source-lineNum" href="#559">559: </a></td><td>}</td></tr><tr id="560" class="source-line"><td><a class="source-lineNum" href="#560">560: </a></td><td></td></tr></table>
		</div>

		<div class="layout-footer">
			OpenCart API API documentation generated by <a href="https://www.apigen.org">ApiGen dev-master</a>
		</div>
	</div>

	<div class="layout-rest">
		<div class="navbar"></div>
	</div>
</body>
</html>
